/**
 * 公共常量.
 */
//存储userid，openid信息
var PLATFORM_AUTH_ID$CACHE = "platformAuthId";
var EMP_INFO$CACHE="empInfo";
var SYSID$CACHE="sysId";
var DDCORPID$CACHE="ddCorpId";
var IS_DEBUG = 0;

window["Supp_URL"] = Supp_URL = { };

window["Supp_CONST"] = Supp_CONST = { };
Supp_CONST.DOMAIN_URL = "http://wxdev.supporter.com.cn";

/**
 * Supp移动应用基础组件.
 *
 * 浅度（静态）继承范例：
 * <pre>
 * var obj1 = {
 *     myName: "张三",
 *     myFun : function() {}
 * };
 *
 * var obj2 = {};
 *
 * //obj2继承obj1
 * SuppMobile.Base.staticExtend(obj2, obj1);
 * </pre>
 */
(function(parentNames) {
    function create(names) {
        var aryNames = names.split(".");

        //组件类（构造函数）创建
        var parentObject = (window[aryNames[0]] == null ? {} : window[aryNames[0]]);
        window[aryNames[0]] = parentObject;

        for (var i = 1; i < aryNames.length; i++) {
            parentObject = parentObject[aryNames[i]] = (parentObject[aryNames[i]] == null ? {} : parentObject[aryNames[i]]);
        }

        return parentObject;
    }

    var j$Base = create(parentNames);
    j$Base.create = create;

    j$Base.prototypeExtend = function(C, P) {
        if ( C instanceof Function) {
            C.prototype = new P();
            C.prototype.constructor = C;
        }

        return C;
    };

    j$Base.staticExtend = function(C, P) {
        for (var p in P) {
            C[p] = (C[p] == null ? P[p] : C[p]);
        }

        return C;
    };

    j$Base.extend = function(C, P) {
        j$Base.prototypeExtend(C, P);
        j$Base.staticExtend(C, P);

        return C;
    };

    j$Base.clone = function(P) {
        var O = {};
        return j$Base.extend(O, P);
    };

    //window["Supp.Base"] = j$Base;
})("Supp.Base");
//重写jquery load方法，用于修改html页面的相对路径为绝对路径，ps：传入url必须为绝对路径
(function ($) {
    //重写jquery load方法，用于覆盖各功能模块使用的load
    jQuery.fn.loadPage = function (url, params, callback) {
        
        //var obj = callback;
        if (typeof url !== "string" && _load) {
            return _load.apply(this, arguments);
        }
        
        var selector, response, type,
            self = this,
            off = url.indexOf(" ");
        
        if (off >= 0) {
            selector = jQuery.trim(url.slice(off, url.length));
            url = url.slice(0, off);
        }
        
        // If it's a function
        if (jQuery.isFunction(params)) {

            // We assume that it's the callback
            callback = params;
            params = undefined;

            // Otherwise, build a param string
        } else if (params && typeof params === "object") {
            type = "POST";
        }

        // If we have elements to modify, make the request
        if (self.length > 0) {
            jQuery.ajax({
                url: url,
                // if "type" variable is undefined, then "GET" method will be used
                type: type,
                dataType: "html",
                data: params
            }).done(function (responseText) {
                var loadhref = url.substring(0, url.lastIndexOf("\/"));
                var loadPageName = url.substring(url.lastIndexOf("\/") + 1, url.lastIndexOf("."));
                var $loadHtml = $($("<div>").html(responseText));
                
                if (loadhref != undefined && loadhref != "") {
                    //移除重复css
                    $loadHtml.find("link").each(function (index, element) {
                        var linkHref = $(this).attr('href');
                        var httpIndex = linkHref.indexOf("http");
                        if (typeof linkHref != "undefined") {
                            if (httpIndex < 0) {
                                $(this).attr('href', loadhref + "/" + linkHref);
                            }
                        }
                    });
                    //移除重复js
                    $loadHtml.find("script").each(function (index, element) {
                        var srcUrl = $(this).attr('src');
                        if (typeof srcUrl != "undefined") {
                            var httpIndex = srcUrl.indexOf("http");
                            if (httpIndex < 0) {
                                $(this).attr('src', loadhref + "/" + srcUrl);
                            }
                        }
                    });
                }
                
                window[loadPageName + "_params"] = params;
                // Save response for use in complete callback
                response = arguments;

                self.html(selector ?

                    // If a selector was specified, locate the right elements in a dummy div
                    // Exclude scripts to avoid IE 'Permission Denied' errors
                    jQuery("<div>").append(jQuery.parseHTML($loadHtml.html())).find(selector) :
                    
                    // Otherwise use the full result
                    $loadHtml.html());

            }).complete(callback && function (jqXHR, status) {
                    self.each(callback, response || [jqXHR.responseText, status, jqXHR]);
                });
        }

        return this;
    };
})(jQuery);/**
 * Supp Platform库.
 *
 * @Creator      : LiuJiedong
 * @Create Date  : 2017-9-20
 * @Since        : 06.00.0000
 * Modifier      :
 * Modified Date :
 * @Dependences  : supp-base.js
 * @Description  : 判断当前属于哪个平台
 */
(function(parentObj, parentNames) {
    var $Platform = parentObj.create(parentNames);

    var PROXY_URL_MP = "/service/wechat/mp/proxy";
    var PROXY_URL_CP = "/service/wechat/cp/proxy";
    var PROXY_URL_DD = "/service/dingtalk/proxy";
    var PROTAL_URL_MP = "/service/wechat/mp/portal";
    var PROTAL_URL_CP = "/service/wechat/cp/portal";
    var PROTAL_URL_DD = "/service/dingtalk/portal";

    /*客户端是否为微信公众号*/
    $Platform.isWeiXin = function() {
        if (IS_DEBUG == 1) {
            return true;
        }
        return window.navigator.userAgent.indexOf('MicroMessenger') >= 0 && window.navigator.userAgent.indexOf('wxwork') < 0;
    }
    /*客户端是否为企业微信*/
    $Platform.isCpWeiXin = function() {
        return window.navigator.userAgent.indexOf('MicroMessenger') >= 0 && window.navigator.userAgent.indexOf('wxwork') >= 0;
    }
    /*客户端是否为钉钉*/
    $Platform.isDingTalk = function() {
        return window.navigator.userAgent.indexOf('AliApp') >= 0 || window.navigator.userAgent.indexOf('DingTalk') >= 0;
    }
    /*
     * 权限列表
     * startRecord 开始录音
     * stopRecord 停止录音
     * onVoiceRecordEnd 录音结束
     * playVoice 播放录音
     * pauseVoice 暂停录音
     * stopVoice 停止录音
     * onVoicePlayEnd 播放结束
     * uploadVoice 上传录音
     * chooseImage 选择图片
     * previewImage 预览图片
     * uploadImage 上传图片
     * requestAuthCode 获取钉钉userid认证需要的code，仅支持钉钉
     */

    /*权限初始化，传入字符串数组*/
    $Platform.jsApiList = function(jsApiList) {
        var changedJsApiList = [];
        for (var i = 0; i < jsApiList.length; i++) {
            var jsAPI = jsApiList[i];
            if (Supp.Platform.isWeiXin() || Supp.Platform.isCpWeiXin()) {
                if (jsAPI != "" && jsAPI != "requestAuthCode") {
                    changedJsApiList.push(jsAPI);
                }

            } else if (Supp.Platform.isDingTalk()) {

                switch(jsAPI) {
                case "startRecord": {
                    changedJsApiList.push("device.audio.startRecord");
                    break;
                }
                case "stopRecord": {
                    changedJsApiList.push("device.audio.stopRecord");
                    break;
                }
                case "onVoiceRecordEnd": {
                    changedJsApiList.push("device.audio.onRecordEnd");
                    break;
                }
                case "playVoice": {
                    changedJsApiList.push("device.audio.play");
                    break;
                }
                case "pauseVoice": {
                    changedJsApiList.push("device.audio.pause");
                    break;
                }
                case "stopVoice": {
                    changedJsApiList.push("device.audio.stop");
                    break;
                }
                case "onVoicePlayEnd": {
                    changedJsApiList.push("device.audio.onPlayEnd");
                    break;
                }
                case "chooseImage": {
                    changedJsApiList.push("biz.util.uploadImage");
                    break;
                }
                case "previewImage": {
                    changedJsApiList.push("biz.util.previewImage");
                    break;
                }
                case "requestAuthCode": {
                    changedJsApiList.push("runtime.permission.requestAuthCode");
                    break;
                }
                }

            }
        }

        return changedJsApiList;
    }
    /**
     * 获取签名信息,初始化配置.
     */
    $Platform.config = function(jsApiList, ready_callback) {
        var configUrl = Supp.Platform.portalUrl() + "/getJSConfig";
        var changedJsApiList = Supp.Platform.jsApiList(jsApiList);

        var sysId = Supp.Uri.query(SYSID$CACHE);
        if (sysId) {
            Supp.LocStorage.setVal(SYSID$CACHE, sysId);
        } else {
            sysId = Supp.LocStorage.getVal(SYSID$CACHE);
        }

        Supp.ajax({
            "type" : "post",
            "url" : configUrl,
            "data" : {
                "url" : window.location.href,
                "sysId" : sysId
            },
            "success" : function(result) {
                var configObj = result.body;
                if (Supp.Platform.isWeiXin()) {
                    wx.config({
                        debug : false,
                        appId : configObj.appId, // 必填，公众号的唯一标识
                        timestamp : configObj.timestamp, // 必填，生成签名的时间戳
                        nonceStr : configObj.nonceStr, // 必填，生成签名的随机串
                        signature : configObj.signature, // 必填，签名，见附录1
                        jsApiList : changedJsApiList // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
                    });
                    if (ready_callback) {
                        wx.ready(function() {
                            ready_callback();
                        });
                    }
                } else if (Supp.Platform.isCpWeiXin()) {
                    wx.config({
                        beta : true, // 必须这么写，否则在微信插件有些jsapi会有问题
                        debug : false,
                        appId : configObj.appId, // 必填，公众号的唯一标识
                        timestamp : configObj.timestamp, // 必填，生成签名的时间戳
                        nonceStr : configObj.nonceStr, // 必填，生成签名的随机串
                        signature : configObj.signature, // 必填，签名，见附录1
                        jsApiList : changedJsApiList// 必填，需要使用的JS接口列表，所有JS接口列表见附录2
                    });
                    if (ready_callback) {
                        wx.ready(function() {
                            ready_callback();
                        });
                    }
                } else if (Supp.Platform.isDingTalk()) {
                    dd.config({
                        agentId : configObj.agentId, // 必填，微应用ID
                        corpId : configObj.corpId, //必填，企业ID
                        timeStamp : configObj.timestamp, // 必填，生成签名的时间戳
                        nonceStr : configObj.nonceStr, // 必填，生成签名的随机串
                        signature : configObj.signature, // 必填，签名
                        type : 0, //选填。0表示微应用的jsapi,1表示服务窗的jsapi。不填默认为0。该参数从dingtalk.js的0.8.3版本开始支持
                        jsApiList : changedJsApiList// 必填，需要使用的jsapi列表，注意：不要带dd。
                    });
                    Supp.LocStorage.setVal(DDCORPID$CACHE, configObj.corpId);
                    dd.error(function(err) {
                        // alert(JSON.stringify(err));
                        // Supp.UI.alert('dd error: ' + JSON.stringify(err));
                    });

                    if (ready_callback) {
                        dd.ready(function() {
                            ready_callback();
                        });
                    } else {
                        dd.ready(function() {

                        });
                    }
                }
            }
        });
    };

    /*开始录音*/
    $Platform.startRecord = function() {
        if (Supp.Platform.isWeiXin() || Supp.Platform.isCpWeiXin()) {
            wx.startRecord();
        } else if (Supp.Platform.isDingTalk()) {
            dd.device.audio.startRecord({
                onSuccess : function() {
                },
                onFail : function(err) {
                }
            });
        } else {
            Supp.UI.openToast({
                "duration" : 1000,
                "msg" : "不支持该平台下调用startRecord"
            });
        }
    }
    /*停止录音*/
    $Platform.stopRecord = function(arg) {
        if (Supp.Platform.isWeiXin() || Supp.Platform.isCpWeiXin()) {
            wx.stopRecord({
                success : function(res) {
                    if (arg.success) {
                        arg.success(res);
                    }
                }
            });
        } else if (Supp.Platform.isDingTalk()) {
            dd.device.audio.stopRecord({
                onSuccess : function(res) {
                    var _res = {};
                    _res.localId = res.mediaId;
                    if (arg.success) {
                        arg.success(_res);
                    }
                },
                onFail : function(err) {

                }
            });
        } else {
            Supp.UI.openToast({
                "duration" : 1000,
                "msg" : "不支持该平台下调用startRecord"
            });
        }
    }
    /*
     * 上传语音，只支持微信
     * localId 需要上传的音频的本地ID，由stopRecord接口获得
     * isShowProgressTips // 默认为1，显示进度提示
     */
    $Platform.uploadVoice = function(arg) {
        if (Supp.Platform.isWeiXin() || Supp.Platform.isCpWeiXin()) {
            wx.uploadVoice({
                localId : arg.localId, // 需要上传的音频的本地ID，由stopRecord接口获得
                isShowProgressTips : arg.isShowProgressTips, // 默认为1，显示进度提示
                success : function(res) {
                    if (arg.success) {
                        arg.success(res);
                    }
                }
            });
        } else if (Supp.Platform.isDingTalk()) {
            var res = {};
            res.serverId = arg.localId;
            if (arg.success) {
                arg.success(res);
            }
        }

    }
    /*
     * 录音结束事件
     */
    $Platform.onVoiceRecordEnd = function(arg) {
        if (Supp.Platform.isWeiXin() || Supp.Platform.isCpWeiXin()) {
            wx.onVoiceRecordEnd({
                // 录音时间超过一分钟没有停止的时候会执行 complete 回调
                complete : function(res) {
                    if (arg.success) {
                        arg.success(res);
                    }
                }
            });
        } else if (Supp.Platform.isDingTalk()) {
            dd.device.audio.onRecordEnd({
                // 录音时间超过一分钟没有停止的时候会执行 complete 回调
                onSuccess : function(res) {
                    if (arg.success) {
                        arg.success(res);
                    }
                },
                onFail : function(err) {
                }
            });
        }
    }
    /*播放录音*/
    $Platform.playVoice = function(arg) {
        if (Supp.Platform.isWeiXin() || Supp.Platform.isCpWeiXin()) {
            wx.playVoice({
                localId : arg.localId // 需要播放的音频的本地ID，由stopRecord接口获得
            });
        } else if (Supp.Platform.isDingTalk()) {
            //开始播放
            dd.device.audio.play({
                localAudioId : arg.localId, // 需要播放的音频的本地ID，由stopRecord接口获得
                onSuccess : function() {

                },
                onFail : function(err) {
                    // alert("play err" + JSON.stringify(err));
                }
            });
            /* 播放结束
             * 钉钉必须每次调用play事件后调用停止事件的监听
             */
            dd.device.audio.onPlayEnd({
                onSuccess : function(res) {
                    var localId = res.localAudioId;
                    var _res = {};
                    _res.localId = localId;
                    if (arg.success) {
                        arg.success(_res);
                    }
                },
                onFail : function(err) {
                    // alert("play err" + JSON.stringify(err));
                }
            });
        } else {
            Supp.UI.openToast({
                "duration" : 1000,
                "msg" : "不支持该平台下调用playVoice"
            });
        }
    }
    /*暂停播放录音*/
    $Platform.pauseVoice = function(arg) {
        if (Supp.Platform.isWeiXin() || Supp.Platform.isCpWeiXin()) {
            wx.pauseVoice({
                localId : arg.localId // 需要暂停的音频的本地ID
            });
        } else if (Supp.Platform.isDingTalk()) {
            dd.device.audio.pause({
                localAudioId : arg.localId,
                onSuccess : function() {
                },
                onFail : function(err) {
                }
            });
        } else {
            Supp.UI.openToast({
                "duration" : 1000,
                "msg" : "不支持该平台下调用pauseVoice"
            });
        }
    }
    /*
     * 录音播放结束事件
     */
    $Platform.onVoicePlayEnd = function(arg) {
        if (Supp.Platform.isWeiXin() || Supp.Platform.isCpWeiXin()) {
            wx.onVoicePlayEnd({
                // 录音时间超过一分钟没有停止的时候会执行 complete 回调
                success : function(res) {
                    if (arg.success) {
                        arg.success(res);
                    }
                }
            });
        } else if (Supp.Platform.isDingTalk()) {
            //播放结束
            dd.device.audio.onPlayEnd({
                onSuccess : function(res) {
                    var localId = res.localAudioId;
                    var _res = {};
                    _res.localId = localId;
                    if (arg.success) {
                        arg.success(_res);
                    }
                }
            });
        }
    }
    /*
     * 选择图片、拍照上传
     * max 最大上传数
     * sizeType 可以指定是原图还是压缩图，钉钉只支持其中一种，如果传入多个，钉钉选择第一个作为默认压缩选项 ['original', 'compressed']
     * quality 只支持钉钉,图片压缩质量 0-100之间数字，越大质量越好
     * resize 只支持钉钉，图片缩放率 0-100之间数字，越小缩放后尺寸越小
     * sourceType 只支持微信，可以指定来源是相册还是相机,默认两者都有['album', 'camera']，钉钉相册拍照多有
     * success 成功后的回调
     */
    $Platform.chooseImage = function(arg) {
        //是否压缩
        var compression = true;
        if (arg.sizeType && arg.sizeType.length > 0) {
            if (arg.sizeType[0] == 'original') {
                compression = false;
            }
        }
        var multiple = false;
        if (arg.max > 1) {
            multiple = true;
        }
        if (Supp.Platform.isWeiXin() || Supp.Platform.isCpWeiXin()) {
            wx.chooseImage({
                count : arg.max, //最多选5张
                sizeType : arg.sizeType, // 可以指定是原图还是压缩图，默认二者都有
                sourceType : arg.sourceType, // 可以指定来源是相册还是相机，默认二者都有
                success : function(res) {
                    if (arg.success) {
                        arg.success(res);
                    }
                }
            });
        } else if (Supp.Platform.isDingTalk()) {
            dd.biz.util.uploadImage({
                compression : compression, //(是否压缩，默认为true)
                multiple : multiple, //是否多选，默认false
                max : arg.max, //最多可选个数
                quality : arg.quality, // 图片压缩质量,
                resize : arg.resize, // 图片缩放率
                stickers : {// 水印信息
                },
                onSuccess : function(res) {
                    var _res = {};
                    _res.localIds = res;
                    if (arg.success) {
                        arg.success(_res);
                    }
                },
                onFail : function(err) {
                    // alert("err:" + JSON.stringify(err));
                }
            });
        } else {
            Supp.UI.openToast({
                "duration" : 1000,
                "msg" : "不支持该平台下调用chooseImage"
            });
        }
    }
    /*
     * 上传图片，只支持微信
     * localId 图片的本地id，通过chooseImage接口获取
     * success 成功后的回调
     */
    $Platform.uploadImage = function(arg) {
        var localId = arg.localId;
        if (Supp.Platform.isWeiXin() || Supp.Platform.isCpWeiXin()) {
            wx.uploadImage({
                localId : localId,
                success : function(res) {
                    var serverId = res.serverId;
                    //安卓手机处理上传
                    if (Supp.Util.isAndroidOS()) {
                        if (arg.success) {
                            var _res = {};
                            _res.serverId = serverId;
                            _res.filePath = localId;
                            _res.localId = localId;
                            arg.success(_res);
                        }
                    } else {
                        /*
                         * 苹果手机处理上传，首先检测是否支持getLocalImgData
                         * 微信公众号支持getLocalImgData，企业微信不支持
                         */
                        wx.checkJsApi({
                            jsApiList : ['getLocalImgData'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
                            success : function(res) {
                                // 以键值对的形式返回，可用的api值true，不可用为false
                                // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
                                if (res.checkResult.getLocalImgData) {
                                    wx.getLocalImgData({
                                        localId : localId, //图片的localID
                                        success : function(result) {
                                            if (arg.success) {
                                                var _res = {};
                                                _res.serverId = serverId;
                                                _res.filePath = result.localData;
                                                _res.localId = localId;
                                                arg.success(_res);
                                            }
                                        }
                                    });
                                } else {
                                    if (arg.success) {
                                        var _res = {};
                                        _res.serverId = serverId;
                                        _res.filePath = localId;
                                        _res.localId = localId;
                                        arg.success(_res);
                                    }
                                }
                            }
                        });
                    }
                },
                fail : function(res) {
                }
            });
        } else if (Supp.Platform.isDingTalk()) {
            var _res = {};
            if (arg.success) {
                _res.serverId = localId;
                _res.filePath = localId;
                _res.localId = localId;
                arg.success(_res);
            }
        }

    }
    /*
     * 登录认证，微信公众号获取openid，企业微信获取userid，钉钉获取userid
     * agentId 企业微信的应用id
     */
    $Platform.auth = function(arg) {
        var sysId = Supp.Uri.query(SYSID$CACHE);
        if (sysId) {
            Supp.LocStorage.setVal(SYSID$CACHE, sysId);
        } else {
            sysId = Supp.LocStorage.getVal(SYSID$CACHE);
        }
        var auth_context = Supp.LocStorage.getVal(PLATFORM_AUTH_ID$CACHE);
        var fromurl = location.href;
        if (Supp.Platform.isWeiXin()) {
            var openId = "";
            if (IS_DEBUG == 1) {
                openId = "oeMMEuBPI9aOF1Y6yMmz9padFhv0";
            } else {
                openId = auth_context ? auth_context.openId : "";
            }
            var access_code = Supp.Uri.query('code');
            if (openId && openId != "") {
                if (arg.success) {
                    arg.success();
                }
                return openId;
            }
            if (access_code == null) {
                //获取code的认证url
                Supp.ajax({
                    "type" : "post",
                    "url" : Supp.Platform.portalUrl() + "/getOauth2buildAuthorizationUrl",
                    "data" : {
                        "redirectURI" : fromurl,
                        "scope" : "snsapi_base",
                        "state" : "STATE",
                        "sysId" : sysId
                    },
                    "success" : function(result) {
                        var url = result.body.url;
                        if (url) {
                            location.href = url;
                        } else {
                            Supp.UI.openToast('身份识别失败 ');
                        }
                    }
                });
                return;
            }
            Supp.ajax({
                "type" : "post",
                "url" : Supp.Platform.portalUrl() + "/getOpenId",
                "data" : {
                    "code" : access_code,
                    "sysId" : sysId
                },
                "success" : function(result) {
                    var openid = result.body.openId;
                    if (openid) {
                        var _context = {
                            "openId" : openid
                        };
                        Supp.LocStorage.setVal(PLATFORM_AUTH_ID$CACHE, _context);
                        var employee = {
                            "empId" : result.body.empId,
                            "empName" : result.body.empName
                        };
                        Supp.LocStorage.setVal(EMP_INFO$CACHE, employee);
                        if (arg.success) {
                            arg.success();
                        }
                    } else {
                        Supp.UI.openToast('身份识别失败 ');
                    }
                }
            });

        } else if (Supp.Platform.isCpWeiXin()) {
            var userId = auth_context ? auth_context.userId : "";
            if (userId) {
                if (arg.success) {
                    arg.success();
                }
                return;
            }
            var access_code = Supp.Uri.query('code');
            if (access_code == null) {
                //获取code的认证url
                Supp.ajax({
                    "type" : "post",
                    "url" : Supp.Platform.portalUrl() + "/getOauth2buildAuthorizationUrl",
                    "data" : {
                        "redirectURI" : fromurl,
                        "scope" : "snsapi_base",
                        "state" : "STATE",
                        "sysId" : sysId
                    },
                    "success" : function(result) {
                        var url = result.body.url;
                        if (url) {
                            location.href = url;
                        } else {
                            Supp.UI.openToast('身份识别失败 ');
                        }
                    }
                });
                return;
            }
            Supp.ajax({
                "type" : "post",
                "url" : Supp.Platform.portalUrl() + "/getUserId",
                "data" : {
                    "code" : access_code,
                    "sysId" : sysId
                },
                "success" : function(result) {
                    if (result.successful) {
                        var resultObj = result.body;
                        var userId = resultObj.userId;
                        if (userId) {
                            var _context = {
                                "userId" : userId,
                                "tenantNo" : resultObj.tenantNo
                            };
                            Supp.LocStorage.setVal(PLATFORM_AUTH_ID$CACHE, _context);
                            if (arg.success) {
                                arg.success();
                            }
                        } else {
                            Supp.UI.openToast('身份识别失败 ');
                        }
                    }

                }
            });

        } else if (Supp.Platform.isDingTalk()) {
            var userId = auth_context ? auth_context.userId : "";
            if (userId) {
                if (arg.success) {
                    arg.success();
                }
                return;
            }
            Supp.LocStorage.setVal("redirect_uri", fromurl);
            window.location.href = "../../auth_dd.html";
        }

    };

    /*
     * 登录,微信公众号通过openId,企业微信、钉钉通过userId与企业标识获取用户基本信息
     * agentId 企业微信的应用id
     */
    $Platform.logon = function(arg) {
        var sysId = Supp.Uri.query(SYSID$CACHE);
        if (sysId) {
            Supp.LocStorage.setVal(SYSID$CACHE, sysId);
        } else {
            sysId = Supp.LocStorage.getVal(SYSID$CACHE);
        }
        var context = Supp.LocStorage.getVal(PLATFORM_AUTH_ID$CACHE);
        var params = {};
        params.url = Supp.Platform.AuthUrl();
        if (!context) {
            Supp.Platform.auth();
            return;
        }
        if (Supp.Platform.isWeiXin()) {
            params.type = "post";
            params.data = {
                "openId" : context.openId,
                "sysId" : sysId
            };
            params.success = function(data) {
                if (data.isSuccessful) {
                    var employee = {
                        "empId" : data.body.empId,
                        "empName" : data.body.empName
                    };
                    Supp.LocStorage.setVal(EMP_INFO$CACHE, employee);
                    //登录成功后刷新页面
                    window.location.href = window.location.href;
                }
            }
        } else if (Supp.Platform.isCpWeiXin()) {
            params.type = "post";
            params.data = {
                "userId" : context.userId,
                "tenantNo" : context.tenantNo,
                "sysId" : sysId
            };
            params.success = function(data) {
                if (data.isSuccessful) {
                    var no_acc = data.body.no_acc;
                    if (no_acc) {
                        Supp.LocStorage.setVal("no_acc_platform", no_acc);
                        window.location.href = "../../no_account.html";
                        return;
                    }
                    var employee = {
                        "empId" : data.body.empId,
                        "empName" : data.body.empName
                    };
                    Supp.LocStorage.setVal(EMP_INFO$CACHE, employee);
                    //登录成功后刷新页面
                    window.location.href = window.location.href;
                }
            }
        } else if (Supp.Platform.isDingTalk()) {
            params.type = "post";
            params.data = {
                "userId" : context.userId,
                "tenantNo" : context.tenantNo,
                "sysId" : sysId
            };
            params.success = function(data) {
                if (data.isSuccessful) {
                    var no_acc = data.body.no_acc;
                    if (no_acc) {
                        Supp.LocStorage.setVal("no_acc_platform", no_acc);
                        window.location.href = "../../no_account.html";
                        return;
                    }
                    var employee = {
                        "empId" : data.body.empId,
                        "empName" : data.body.empName
                    };
                    Supp.LocStorage.setVal(EMP_INFO$CACHE, employee);
                    //登录成功后刷新页面
                    window.location.href = window.location.href;
                }
            }
        }
        //执行登录
        Supp.ajax(params);

    }
    /*
     * 获得图片的代理地址
     */
    $Platform.imgfProxyUrl = function() {
        if (Supp.Platform.isWeiXin()) {
            return PROXY_URL_MP + "/i/imgf";
        } else if (Supp.Platform.isCpWeiXin()) {
            return PROXY_URL_CP + "/i/imgf";
        } else if (Supp.Platform.isDingTalk()) {
            return PROXY_URL_DD + "/i/imgf";
        }
        return "";

    }
    /*
     * 获得图片的代理地址
     */
    $Platform.imgProxyUrl = function() {
        if (Supp.Platform.isWeiXin()) {
            return PROXY_URL_MP + "/i/img/";
        } else if (Supp.Platform.isCpWeiXin()) {
            return PROXY_URL_CP + "/i/img/";
        } else if (Supp.Platform.isDingTalk()) {
            return PROXY_URL_DD + "/i/img/";
        }
        return "";

    }
    /*
     * 获得中转服务器的代理地址
     */
    $Platform.portalUrl = function() {
        if (Supp.Platform.isWeiXin()) {
            return PROTAL_URL_MP;
        } else if (Supp.Platform.isCpWeiXin()) {
            return PROTAL_URL_CP;
        } else if (Supp.Platform.isDingTalk()) {
            return PROTAL_URL_DD;
        }
        return "";

    }
    /*
     * 获得下载文件的代理地址
     */
    $Platform.downProxyUrl = function() {
        if (Supp.Platform.isWeiXin()) {
            return PROXY_URL_MP + "/f/download/";
        } else if (Supp.Platform.isCpWeiXin()) {
            return PROXY_URL_CP + "/f/download/";
        } else if (Supp.Platform.isDingTalk()) {
            return PROXY_URL_DD + "/f/download/";
        }
        return "";

    }
    /*
     * 获得服务的代理地址
     */
    $Platform.serviceUrl = function() {
        if (Supp.Platform.isWeiXin()) {
            return PROXY_URL_MP + "/r/service";
        } else if (Supp.Platform.isCpWeiXin()) {
            return PROXY_URL_CP + "/r/service";
        } else if (Supp.Platform.isDingTalk()) {
            return PROXY_URL_DD + "/r/service";
        }
        return "";

    }
    /*
     * 获得openid,userid的代理地址
     */
    $Platform.AuthUrl = function() {
        if (Supp.Platform.isWeiXin()) {
            return PROTAL_URL_MP + "/logon/in";
        } else if (Supp.Platform.isCpWeiXin()) {
            return PROTAL_URL_CP + "/logon/in";
        } else if (Supp.Platform.isDingTalk()) {
            return PROTAL_URL_DD + "/logon/in";
        }
        return "";

    }
})(Supp.Base, "Supp.Platform");
/**
 * Supp移动UI工具.
 */
(function(parentObj, parentNames) {
    var util = parentObj.create(parentNames);
    
    /**
     * 删除指定的数组元素.
     */
    util.delArray = function(ary, index) {
        ary.splice(index, 1);

        return ary;
    };

    /**
     * 判断是否为空.
     */
    util.isEmpty = function(val) {
        return (val == null || val == "");
    };

    /**
     * 判断是否为非空.
     */
    util.isNotEmpty = function(val) {
        return !util.isEmpty(val);
    };
    
    
     //获取手机系统
    util._getMobileInfo = function() {
        return navigator.userAgent;
    };
    
    //是否为iPhone手机
    util.isIPhoneOS = function() {
        return util._getMobileInfo().toUpperCase().indexOf("IPHONE") > -1;
    };
    
    //是否为Android手机
    util.isAndroidOS = function() {
        return util._getMobileInfo().toUpperCase().indexOf("ANDROID") > -1;
    };
    
    //阻止事件冒泡
    util.stopEventPropagation = function(event){
        event = event||window.event; 
        var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
        var isOpera = userAgent.indexOf("Opera") > -1;
        if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
            event.cancelBubble = true;//停止冒泡
        } else {
            event.stopPropagation();
            event.preventDefault();
        }
    };
    
    //判断是否是json
    util.isJson = function(obj) {
        var isjson = typeof(obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && !obj.length; 
        return isjson;
    };
    
    //合并json
    util.concat = function(targetObj, obj) {
        if (this.isJson(obj) && targetObj != undefined) {
            for (index in obj) {
                targetObj[index] = obj[index];
            }
        }
    };
})(Supp.Base, "Supp.Util");/**
 * Supp URI库.
 *
 * @Creator      : LiuJiedong
 * @Create Date  : 2017-9-20
 * @Since        : 06.00.0000
 * Modifier      :
 * Modified Date :
 * @Dependences  : supp-base.js
 * @Description  :
 */
(function(parentObj, parentNames) {
    var $Uri = parentObj.create(parentNames);
    $Uri.query = function(paramName) {
        var reg = new RegExp("(^|&)" + paramName + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null)
            return unescape(r[2]);
        return null;

    }
})(Supp.Base, "Supp.Uri");/**
 * Supp 文本操作工具.
 *
 * @Creator      : DangQingyao
 * @Create Date  : 2017-5-3
 * @Since        : 06.00.0000
 * Modifier      :
 * Modified Date :
 * @Dependences  : supp-base.js, supp-log.js
 * @Description  :
 */
(function(parentObj, parentNames) {
    var textObj = parentObj.create(parentNames);
    textObj.formatDate = function(date, fmt) {
        var o = {
            "M+" : date.getMonth() + 1, //月份
            "d+" : date.getDate(), //日
            "HH+" : date.getHours(), //小时
            "m+" : date.getMinutes(), //分
            "s+" : date.getSeconds(), //秒
            "q+" : Math.floor((date.getMonth() + 3) / 3), //季度
            "S" : date.getMilliseconds() //毫秒
        };

        if (/(y+)/.test(fmt)) {
            fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
        }

        for (var k in o) {
            if (new RegExp("(" + k + ")").test(fmt)) {
                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
            }
        }

        return fmt;
    };

    //去两边空格
    textObj.trim = function(val) {
        if (val == null) {
            return "";
        }

        return val.replace(/(^s*)|(s*$)/g, "");
    };

    //去左边空格
    textObj.ltrim = function(val) {
        if (val == null) {
            return "";
        }

        return val.replace(/(^s*)/g, "");
    };

    //去右边空格
    textObj.ltrim = function(val) {
        if (val == null) {
            return "";
        }

        return val.replace(/(s*$)/g, "");
    };
    
    //将yyyy-MM-dd HH:mm:ss格式的时间转为微博式的时间，如刚刚，几分钟前
    textObj.formatWeiboDate=function (dateStr) {
        var publishTime = _getDateTimeStamp(dateStr) / 1000,
        d_seconds,
        d_minutes,
        d_hours,
        d_days,
        timeNow = parseInt(new Date().getTime() / 1000),
        d,
        date = new Date(publishTime * 1000),
        Y = date.getFullYear(),
        M = date.getMonth() + 1,
        D = date.getDate(),
        H = date.getHours(),
        m = date.getMinutes(),
        s = date.getSeconds();
        //小于10的在前面补0
        if (M < 10) {
                M = '0' + M;
        }
        if (D < 10) {
                D = '0' + D;
        }
        if (H < 10) {
                H = '0' + H;
        }
        if (m < 10) {
                m = '0' + m;
        }
        if (s < 10) {
                s = '0' + s;
        }
 
        d = timeNow - publishTime;
        d_days = parseInt(d / 86400);
        d_hours = parseInt(d / 3600);
        d_minutes = parseInt(d / 60);
        d_seconds = parseInt(d);
 
        if (d_days > 0 && d_days < 3) {
                return d_days + '天前';
        } else if (d_days <= 0 && d_hours > 0) {
                return d_hours + '小时前';
        } else if (d_hours <= 0 && d_minutes > 0) {
                return d_minutes + '分钟前';
        } else if (d_seconds < 60) {
                if (d_seconds <= 0) {
                        return '刚刚';
                } else {
                        return d_seconds + '秒前';
                }
        } else if (d_days >= 3 && d_days < 30) {
                return M + '-' + D + ' ' + H + ':' + m;
        } else if (d_days >= 30) {
                return Y + '-' + M + '-' + D + ' ' + H + ':' + m;
        }
        
    }
 
    function _getDateTimeStamp(dateStr) {
        return Date.parse(dateStr.replace(/-/gi, "/"));
    }　　

})(Supp.Base, "Supp.Text");/**
 * 本地缓存js组件.
 *
 * @author DangQingyao
 * @since 06.00.0000
 */

(function(parentObj, parentNames) {
    //业务级本地存储
    var BUSI_PREFIX = "BUSI$";
    //系统级本地存储
    var SYS_PREFIX = "SYS$";
    //全局本地存储
    var PUB_PREFIX = "PUB$";

    //本地存储的单位时间：1分钟的毫秒数
    var CACHE_UNIT_TIME = 1000 * 60;
    var $cache = parentObj.create(parentNames);

    /**
     * 设置业务级本地存储.
     *  “业务级”本地存储允许通过“清理缓存”功能将其全部删除.
     *
     * @param key 存储到本地的key名
     * @param val 存储到本地的数据
     * @param time 存活时间（单位分钟），这不是一个严格有效的时间，一般是在下次登录或切换页面时才会触发失效检查
     */
    $cache.setVal = function(key, val, time) {
        var valData = {
            "body" : val
        };

        if (time != null && time != "") {
            valData.time = parseInt(new Date().getTime() / CACHE_UNIT_TIME + time);
        }

        _val(BUSI_PREFIX + key, valData);
    };

    /**
     * 获取业务级本地存储.
     *
     * @param key 存储到本地的key名
     * @param isOriginal 是否返回存储的原始值（默认true）
     */
    $cache.getVal = function(key, isOriginal) {
        var value = _val(BUSI_PREFIX + key);

        if (isOriginal === false) {
            return value;
        }

        return (value == null ? null : value.body);
    };

    /**
     * 获取当前租户下的所有本地存储KEY名称.
     *
     * @return 返回keys数组
     */
    $cache.getKeys = function() {
        return _getKeys(BUSI_PREFIX);
    };

    /**
     * 删除业务级本地存储.
     *
     * @param key 存储到本地的key名
     */
    $cache.remove = function(key) {
        window.localStorage.removeItem(BUSI_PREFIX + key);
    };

    /**
     * 删除所有业务级本地存储.
     *
     * @param key 存储到本地的key名
     */
    $cache.clear = function() {
        var keys = $cache.getKeys();
        for (var i = 0; i < keys.length; i++) {
            $cache.remove(keys[i]);
        }
    };

    /**
     * 设置系统级本地存储.
     *  “系统级”本地存储不允许通过“清理缓存”功能将其全部删除.
     *
     * @param key 存储到本地的key名
     * @params val 存储到本地的数据
     * @param time 存活时间（单位分钟），这不是一个严格有效的时间，一般是在下次登录或切换页面时才会触发失效检查
     */
    $cache.setSysVal = function(key, val, time) {
        var valData = {
            "body" : val
        };

        if (time != null && time != "") {
            valData.time = parseInt(new Date().getTime() / CACHE_UNIT_TIME + time);
        }

        _val(SYS_PREFIX + key, valData);
    };

    /**
     * 获取系统级本地存储.
     * @param key 存储的键名
     * @param isOriginal 是否返回存储的原始值（默认true）
     */
    $cache.getSysVal = function(key, isOriginal) {
        var value = _val(SYS_PREFIX + key);

        if (isOriginal === false) {
            return value;
        }

        return (value == null ? null : value.body);
    };

    /**
     * 获取当前租户下的所有系统级本地存储KEY名称.
     *
     * @return 返回keys数组
     */
    $cache.getSysKeys = function() {
        return _getKeys(SYS_PREFIX);
    };

    /**
     * 删除系统级本地存储.
     *
     * @param key 存储到本地的key名
     */
    $cache.removeSys = function(key) {
        window.localStorage.removeItem(SYS_PREFIX + key);
    };

    /**
     * 设置全局级本地存储.
     *  “业务级”本地存储允许通过“清理缓存”功能将其全部删除.
     *
     * @param key 存储到本地的key名
     * @param val 存储到本地的数据
     * @param time 存活时间（单位分钟），这不是一个严格有效的时间，一般是在下次登录或切换页面时才会触发失效检查
     */
    $cache.setPubVal = function(key, val, time) {
        var valData = {
            "body" : val
        };

        if (time != null && time != "") {
            valData.time = parseInt(new Date().getTime() / CACHE_UNIT_TIME + time);
        }

        _val(PUB_PREFIX + key, valData);
    };

    /**
     * 获取全局级本地存储.
     *
     * @param key 存储到本地的key名
     * @param isOriginal 是否返回存储的原始值（默认true）
     */
    $cache.getPubVal = function(key, isOriginal) {
        var value = _val(PUB_PREFIX + key);

        if (isOriginal === false) {
            return value;
        }

        return (value == null ? null : value.body);
    };

    /**
     * 删除全局级本地存储.
     *
     * @param key 存储到本地的key名
     */
    $cache.removePub = function(key) {
        window.localStorage.removeItem(PUB_PREFIX + key);
    };

    /**
     * 获取全局级本地存储KEY名称.
     *
     * @return 返回keys数组
     */
    $cache.getPubKeys = function() {
        return _getKeys(PUB_PREFIX);
    };
    /**
     * 删除无效的本地存储.
     */
    $cache.clearInvalid = function() {
        var currentTime = parseInt(new Date().getTime() / CACHE_UNIT_TIME);

        //删除无效的业务级存储
        var keys = $cache.getKeys();

        for (var i = 0; i < keys.length; i++) {
            var obj = $cache.getVal(keys[i], false);
            if (obj.time != null && currentTime >= obj.time) {
                $cache.remove(keys[i]);
            }
        }

        //删除无效的系统级存储
        var sysKeys = $cache.getSysKeys();

        for (var i = 0; i < sysKeys.length; i++) {
            var obj = $cache.getSysVal(sysKeys[i], false);

            if (obj.time != null && currentTime >= obj.time) {
                $cache.removeSys(sysKeys[i]);
            }
        }
    };

    /**
     * 心跳检查失效数据.
     *
     * @param key 存储到本地的key名
     */
    $cache.startHeartbeat = function() {
        setInterval($cache.clearInvalid, CACHE_UNIT_TIME);
    };

    function _getKeys(type) {
        var allKeys = localStorage;
        var keys = [];
        for (var i = 0; i < allKeys.length; i++) {
            if (allKeys[i].indexOf(type) == 0) {
                keys.push(allKeys[i].substring(type.length));
            }
        }
        return keys;
    };

    /**
     * 获取&设置本地存储.
     */
    function _val(key, val) {
        if (val == null) {
            var value = window.localStorage.getItem(key);
            var valueObj = (value == null || value == "" ? null : JSON.parse(value));
            if (valueObj != null && valueObj.time != null) {
                var currentTime = parseInt(new Date().getTime() / CACHE_UNIT_TIME);
                if (currentTime >= valueObj.time) {
                    window.localStorage.removeItem(key);
                    return null;
                }
            }

            return valueObj;
        }
        window.localStorage.setItem(key, JSON.stringify(val));
    };
})(Supp.Base, "Supp.LocStorage");
/**
 * Supp 代理工具.
 *
 * @Creator      : DangQingyao
 * @Create Date  : 2017-6-16
 * @Since        : 06.00.0000
 * Modifier      :
 * Modified Date :
 * @Dependences  : appcan.js, supp-base.js, supp-log.js
 * @Description  :
 */
(function(parentObj, parentNames) {
    var $Proxy = parentObj.create(parentNames);

    $Proxy.begin = function(funcName) {
        console.log("Proxy - 调用[" + funcName + "]...");
    };

    $Proxy.after = function(funcName) {
        console.log("Proxy - 调用[" + funcName + "]结束!");
    };

    $Proxy.error = function(funcName, e) {
        console.log("Proxy - 调用[" + funcName + "]报错:", e);
        return true;
    };

    /**
     * 通过代理创建方法.
     */
    $Proxy.create = function(funcName, funContent, isPublic) {
        console.log("Proxy - 创建js函数[" + funcName + "]...");
        var functionContent = "" + "try {\n" + "     " + parentNames + ".begin('" + funcName + "');\n" + "     var ff = { exec : " + funContent + "};" + "     var r = ff.exec.apply(this, arguments);\n" + "     " + parentNames + ".after('" + funcName + "');" + "     return r;" + "} catch (e) {\n" + "     " + parentNames + ".error('" + funcName + "' + e, e);" + "     throw e;\n" + "}";

        var f = new Function(functionContent);

        if (isPublic == null || isPlublic == true) {
            window[funcName] = f;
        }

        return f;
    };
})(Supp.Base, "Supp.Proxy");
/**
 * Supp UI页面工具.
 *
 * @Creator      : DangQingyao
 * @Create Date  : 2017-5-15
 * @Since        : 06.00.0000
 * Modifier      :
 * Modified Date :
 * @Dependences  : supp-base.js, supp-log.js
 * @Description  :
 */
(function(parentObj, parentNames) {
    var _PAGE_PARAMS_$CACHE_ = "SHARE$_PAGE_PARAMS_";
    var uiObj = parentObj.create(parentNames);

    jq(function() {
        jq(".loading-mask").unbind("click").click(function() {
            jq(".loading-content").fadeIn(100);
            jq(this).fadeOut(300);
            Supp.UI.closeBusyToast();
        });
    });

    /**
     * 获取传递给当前页面的参数.
     */
    uiObj.getPageParams = function() {
        var data = Supp.LocStorage.getVal(_PAGE_PARAMS_$CACHE_);

        if (data == null) {
            return null;
        }

        return data.v;
    };

    /**
     * 获取传递给当前页面的参数.
     */
    uiObj.setPageParams = function(data) {
        var pageData = null;

        if (data == null) {
            pageData = {};
        } else {
            pageData = {
                v : data
            };
        }

        Supp.LocStorage.setVal(_PAGE_PARAMS_$CACHE_, pageData);
    };

    /**
     * 打开页面.
     *  可以通过传入params.callJs参数和params.callMsg参数呼叫要打开页面中的JS方法。
     *
     * @param params 打开页面相关参数
     * @param data 要传递的数据
     */
    uiObj.openWindow = function(params, data) {
        if (params.name == null) {
            params.name = uiObj.getPageName(params.data);
        }

        uiObj.setPageParams(data);
        window.location.href = params.data;

    };

    //关闭窗体
    uiObj.closeWindow = function(arg) {
        window.history.go(-1);

    };

    /**
     * 设置页面按钮的可用性.
     * @param usability 默认false
     * @param types 要设置的动作类型。默认update|save|delete
     */
    uiObj.doActionUsability = function(usability, types) {
        var disabled = !( usability ? usability : false);

        if (types == null) {
            jq("[action-type='update']").attr("disabled", disabled);
            jq("[action-type='save']").attr("disabled", disabled);
            jq("[action-type='delete']").attr("disabled", disabled);
        } else {
            for (var i = 0; i < types.length; i++) {
                jq("[action-type='" + types[i] + "']").attr("disabled", disabled);
            }
        }
    };

    //打开系统忙碌
    uiObj.openBusyToast = function(msg, autoSetAction) {
        var busyObj = jq(".busy-toast");
        busyObj.fakeLoader();
        busyObj.show();

        if (msg != null) {
            jq(".spinner-text").text(msg);
        }

        if (autoSetAction == true || autoSetAction == null) {
            uiObj.doActionUsability(false);
        }

    };

    //关闭系统忙碌
    uiObj.closeBusyToast = function(autoSetAction) {
        if (autoSetAction == true || autoSetAction == null) {
            uiObj.doActionUsability(true);
        }

        jq(".busy-toast").fadeOut(700);
        jq(".spinner-text").text("");
    };

    //显示加载中的内容
    uiObj.showLoadingContent = function() {
        jq(".loading-content").show();
    };
    //隐藏加载中的内容
    uiObj.hideLoadingContent = function() {
        jq(".loading-content").fadeOut(100);
    };

    //显示遮罩层
    uiObj.showLoadingMask = function(id) {
        try {
            if (id == null) {
                jq(".loading-mask").show();
            } else {
                jq("#" + id).addClass("loading-mask").show();
            }

            //uiObj.openLoading();
            uiObj.openBusyToast();
        } catch (e) {
        }
    };

    //隐藏遮罩层
    uiObj.hideLoadingMask = function(id) {
        var time = 500;
        uiObj.showLoadingContent();
        if (id == null) {
            jq(".loading-mask").fadeOut(time);
        } else {
            jq("#" + id).fadeOut(time);
        }

        uiObj.closeBusyToast();
    };

    /**
     * 提示信息.
     * @param arg.msgCode 提示信息代码
     * @param arg.msg 提示信息
     * @param arg.displayProgress 是否显示进度条
     * @param arg.duration 持续显示时间（默认60秒）
     * @param arg.position 显示位置（默认5，显示中间）
     */
    uiObj.openToast = function(arg) {
        var msg;
        if ( typeof (arg) == "string") {
            msg = arg;
            arg = {};
        } else {
            msg = arg.msg;
        }

        // if (arg.msgCode != null) {
        // msg = Supp.I18N.prop(arg.msgCode);
        // }
        //
        // //默认3秒
        // var duration = (arg.duration ? arg.duration : 5000);
        // //默认：5=中间位置
        // var position = (arg.position ? arg.position : 5);
        // var type = (arg.isDynamic == true ? 1 : 0);
        //1=显示动态加载图标，0=不显示
        mui.toast(msg);
    };

    /**
     * 提示信息.
     */
    uiObj.alert = function(arg) {
        if ( typeof (arg) == "string") {
            mui.alert(arg, Supp.I18N.prop("msg_hint"), function() {

            });

        } else {
            mui.alert(arg.msg, Supp.I18N.prop("msg_hint"), function() {

            });
            _focus(arg.id);
        }
    };

    /**
     * 询问.
     */
    uiObj.confirm = function(msg, _callback) {
        var btnArray = [Supp.I18N.prop("button_ok"), Supp.I18N.prop("button_cancel")];
        mui.confirm(msg, Supp.I18N.prop("msg_hint"), btnArray, function(e) {
            if (e.index == 0) {
                if (_callback) {
                    _callback();
                }
            }
        });

    };

    /**
     * 获取页面地址.
     * @param isRemoteParams 是否删除参数（默认false）
     */
    uiObj.getPagePath = function(isRemoteParams) {
        var MAIN_WIDGET = "/widget/";
        var SUB_WIDGET = "/widgets/";
        var pagePath = window.location.href;
        var index = pagePath.indexOf(MAIN_WIDGET);

        if (index > 0) {
            pagePath = pagePath.substring(index + MAIN_WIDGET.length - 1);
        } else {
            index = pagePath.indexOf(SUB_WIDGET);
            pagePath = pagePath.substring(index + SUB_WIDGET.length);
            var pageStartIndex = pagePath.indexOf("/");
            pagePath = pagePath.substring(pageStartIndex);
        }

        if (isRemoteParams == true) {
            var paramsIndex = pagePath.indexOf("?");
            if (paramsIndex > 0) {
                pagePath = pagePath.substring(0, paramsIndex);
            }
        }

        return pagePath;
    }
    //获取当前页面名称
    uiObj.getPageName = function(pageUrl) {
        pageUrl = (pageUrl == null ? "" + window.location.href : pageUrl);
        var begin = pageUrl.lastIndexOf("/") + 1;
        var end = pageUrl.indexOf(".html");
        return pageUrl.substring(begin, end);
    }
    function _focus(id) {
        if (id == null) {
            return;
        }

        var obj = document.getElementById(id);

        if (obj != null) {
            try {
                obj.focus();
            } catch (e) {
            }
        }
    }

    /**
     * jquery单页面上拉/下拉刷新函数.
     * uiObj.dropload("#list", {
     *      //从上往下滑动
     *      loadUpFn : function(dl) {
     *          dl.resetload();
     *      },
     *      //从下往上滑动
     *      loadDownFn : function(dl) {
     *          dl.resetload();
     *      }
     * });
     *
     * 注意：操作结束后必须执行resetload()进行还原。
     * @param element 支持滑动的元素
     * @param args 滑动参数
     */
    uiObj.dropload = function(element, args) {
        if (args == null) {
            args = {};
        }

        if (args.scrollArea == null) {
            args.scrollArea = window;
        }

        jq(element).dropload(args);
    };

})(Supp.Base, "Supp.UI");/**
 * Supp 多国语言工具.
 *
 * @Creator      : DangQingyao
 * @Create Date  : 2017-5-3
 * @Since        : 06.00.0000
 * Modifier      :
 * Modified Date :
 * @Dependences  : supp-base.js, supp-log.js
 * @Description  :
 */
(function(parentObj, parentNames) {
    var $I18N_YES = "true";
    var $I18N_NO = "false";
    var $I18N_TENANT_DEFAULT = "supp";

    var $I18N = parentObj.create(parentNames);

    function _doI18NFill(data, isCommon) {
        var isEmpty = true;

        if (data == null) {
            return isEmpty;
        }

        for (var p in data) {
            if (p != null && p.substring(0, 1) == "<") {
                try {
                    delete data[p];
                } catch (e) {
                }

                continue;
            }

            isEmpty = false;
            var i18nClass = p;
            var i18nPropName = null;
            var index = p.indexOf("$");

            if (index > 0) {
                i18nClass = p.substring(0, index);
                i18nPropName = p.substring(index + 1);
            }

            var obj = jQuery(".i18n-" + i18nClass);

            if (obj != null && obj.length > 0) {
                if (i18nPropName == null) {
                    obj.html("" + data[p]);
                } else {
                    obj.attr(i18nPropName, "" + data[p]);
                }
            }
        }

        return isEmpty;
    };

    $I18N.load = function(file, isBaseDir) {
        var index = file.lastIndexOf("/") + 1;
        var fileName = file.substring(index);
        var fileDir = file.substring(0, index);
        var serverAddr = "";
        var language = "*";
        var tenant = $I18N_TENANT_DEFAULT;
        var context = null;

        try {
            context = Supp.MEIP.getContext();
            language = (context.language ? context.language.code : language);
        } catch (e) {
        }
        try {
            if (context != null) {
                tenant = (context.tenant ? context.tenant : tenant);
            }
        } catch (e) {
        }

        var dirBeginStr = (isBaseDir == true ? "" : "/");

        fileDir = dirBeginStr + "tenant_files/" + tenant + "/langs" + fileDir;

        var commonFileDir = dirBeginStr + "tenant_files/" + tenant + "/langs/mobile/common/";
        var commonFileName = "common";
        //加载当前资源
        _loadLocalFile(commonFileDir, commonFileName, language, true, function() {
            _loadLocalFile(fileDir, fileName, language, false);
        });

    };

    $I18N.prop = function(key, arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
        var val = jQuery.i18n.prop(key, arg0, arg1, arg2, arg3, arg4, arg5, arg6);
        return (val == null ? "" : val);
    };

    //远程多语言文件
    var $I18N_USE_REMOTE$CACHE = "$I18N_USE_REMOTE";
    //TODO dangqy@2017.5.27：KEY名是否统一？
    /**
     * 是否使用远程服务器资源.
     * @param useRemote true表示使用（默认false）
     */
    $I18N.useRemote = function(useRemote) {
        if (useRemote == null) {
            return (window.localStorage.getItem($I18N_USE_REMOTE$CACHE) == $I18N_YES);
        }

        window.localStorage.setItem($I18N_USE_REMOTE$CACHE, useRemote == true ? $I18N_YES : $I18N_NO);
    }
    //缓存
    var $I18N_USE_CACHE$CACHE = "$I18N_USE_CACHE";
    $I18N.cache = function(useCache) {
        if (useCache == null) {
            return (window.localStorage.getItem($I18N_USE_CACHE$CACHE) == $I18N_YES);
        }

        window.localStorage.setItem($I18N_USE_CACHE$CACHE, useCache == true ? $I18N_YES : $I18N_NO);
    }
    //编码
    var $I18N_ENCODING$CACHE = "$I18N_ENCODING";
    $I18N.encoding = function(encode) {
        if (encode == null) {
            var val = window.localStorage.getItem($I18N_ENCODING$CACHE);
            return (val == null || val == "" ? "UTF-8" : val);
        }

        return window.localStorage.setItem($I18N_ENCODING$CACHE, encode);
    }
    /**
     * 加载远程多国语言文件.
     */
    function _loadRemoteFile(fileDir, fileName, language, isCommon, _callback) {
        fileDir = (fileDir.indexOf("/") == 0 ? fileDir : "/" + fileDir);

        var serverAddr = "";

        if ($I18N.useRemote()) {
            try {
                serverAddr = Supp.MEIP.getContext().server.serverAddr;
            } catch (e) {
            }
        }

        var CACHE_KEY = jq.md5(serverAddr + fileDir + fileName + "$" + language);
        var cacheRemoteMap = Supp.LocStorage.getVal(CACHE_KEY);

        if (cacheRemoteMap != null) {
            jQuery.i18n.map = cacheRemoteMap;
            if (isCommon == true) {
                _callback.call();
            } else {
                _doI18NFill(jQuery.i18n.map);
            }

            return;
        }

        //加载当前资源
        jQuery.i18n.properties({// 加载资浏览器语言对应的资源文件
            _CACHE_KEY : CACHE_KEY,
            name : fileName, // 资源文件名称
            path : serverAddr + fileDir, // 资源文件路径
            mode : 'map', // 用 Map 的方式使用资源文件中的值
            language : language, // 对应的语言
            cache : $I18N.cache(),
            encoding : $I18N.encoding(),
            callback : function(x) {// 加载成功后设置显示内容
                Supp.LocStorage.setVal(this._CACHE_KEY, jQuery.i18n.map);

                if (isCommon == true) {
                    _callback.call();
                } else {
                    _doI18NFill(jQuery.i18n.map);
                }
            }
        });
    };

    /**
     * 加载本地多国语言文件.
     */
    function _loadLocalFile(fileDir, fileName, language, isCommon, _callback) {
        var CACHE_KEY = jq.md5(fileDir + fileName + "$" + language);
        var cacheLocalMap = Supp.LocStorage.getVal(CACHE_KEY);

        if (cacheLocalMap != null) {
            jQuery.i18n.map = cacheLocalMap;

            if ($I18N.useRemote()) {
                _loadRemoteFile(fileDir, fileName, language, isCommon, _callback);
            } else {
                if (isCommon == true) {
                    _callback.call();
                } else {
                    _doI18NFill(jQuery.i18n.map);
                }
            }

            return;
        }

        var localBaseDir = "";

        try {
            localBaseDir = Supp.MEIP.getBaseDir();
        } catch (e) {
        }

        jQuery.i18n.properties({// 加载资浏览器语言对应的资源文件
            fileDir : fileDir,
            fileName : fileName,
            isCommon : isCommon,
            _callback : _callback,
            _CACHE_KEY : CACHE_KEY,

            name : fileName, // 资源文件名称
            path : localBaseDir + fileDir, // 资源文件路径
            mode : 'map', // 用 Map 的方式使用资源文件中的值
            language : language, // 对应的语言
            cache : $I18N.cache(),
            encoding : $I18N.encoding(),
            callback : function(x) {// 加载成功后设置显示内容

                //缓存本地多语言
                Supp.LocStorage.setVal(this._CACHE_KEY, jQuery.i18n.map);

                if ($I18N.useRemote()) {
                    _loadRemoteFile(this.fileDir, this.fileName, this.language, this.isCommon, this._callback);
                } else {
                    if (this.isCommon == true) {
                        this._callback.call();
                    } else {
                        _doI18NFill(jQuery.i18n.map);
                    }
                }
            }
        });
    }

})(Supp.Base, "Supp.I18N");/**
 * Supp Ajax工具.
 *
 * @Creator      : DangQingyao
 * @Create Date  : 2017-5-9
 * @Since        : 06.00.0000
 * Modifier      :
 * Modified Date :
 * @Dependences  : supp-base.js, jquery.js, vue.js（若依赖）
 * @Description  :
 */

//~ Fields
// ====================================================================================================================

//~ Public Functions
// ====================================================================================================================
/**
 * Ajax 工具.
 * <pre>
 *
 * </pre>
 */

(function(parentObj, parentNames) {
    var TIME_OUT = 1000 * 60 * 2;

    var $Ajax = parentObj.create(parentNames);
    var $AJAX_USE_REMOTE_SERVER$CACHE = "$AJAX_USE_REMOTE_SERVER";
    var $AJAX_YES = "true";

    //进入登录页面
    $Ajax.intoLogonPage = function() {
        Supp.Platform.logon();
    };

    //移动应用服务器会话ID
    $Ajax.mobileAppSessionId = function(jssId) {
        if (jssId == null) {
            return window.localStorage.getItem(MOBILE_APP_JSESSION_ID$CACHE);
        }

        window.localStorage.setItem(MOBILE_APP_JSESSION_ID$CACHE, jssId);
    };

    //远程应用服务器会话ID
    $Ajax.remoteAppSessionId = function(rjssId) {
        if (rjssId == null) {
            return window.localStorage.getItem(REMOTE_APP_JSESSION_ID$CACHE);
        }

        window.localStorage.setItem(REMOTE_APP_JSESSION_ID$CACHE, rjssId);
    };

    /**
     * 是否连接远程服务器.
     * @param val true启用（默认）
     */
    $Ajax.useRemoteServer = function(val) {
        if (val == null) {
            var _useRemoteServer = window.localStorage.getItem($AJAX_USE_REMOTE_SERVER$CACHE);
            return (_useRemoteServer == null || _useRemoteServer == $AJAX_YES);
        }

        window.localStorage.setItem($AJAX_USE_REMOTE_SERVER$CACHE, val ? $AJAX_YES : val);
    }
    //判断是否登录超时
    $Ajax.checkLoginTimeout = function(resp) {
        try {
            if (resp.msgCode == "403") {
                return true;
            }

            if ( typeof (resp) == "string") {
                return JSON.parse(resp).msgCode == "403";
            }
        } catch (e) {
        }

        return false;
    };
    //是否启用缓存|是否更新缓存|缓存有效时间|缓存条件、规则
    /**
     * 获取启用缓存请求的参数.
     * @param useCache 是否使用缓存(true|“T”表示使用，默认不适用)
     * @param isUpdate 是否更新缓存(true|“T”表示使用，默认不更用)
     * @param time 缓存有效时间(默认使用后台设置的时间，即5分钟)
     * @param rule 缓存规则，莫倩尚未使用
     */
    $Ajax.getUseCacheParams = function(useCache, isUpdate, time, rule) {
        useCache = (useCache == true || useCache == "T" ? "T" : "");
        isUpdate = (isUpdate == true || isUpdate == "T" ? "T" : "");
        time = (time == null ? "" : time);
        rule = (rule == null ? "" : rule);

        return {
            name : "_CAC",
            value : useCache + "_" + isUpdate + "_" + time + "_" + rule
        };
    };

    /**
     * ajax操作.
     *
     * @param params
     *  {
     *  url : 地址（必填）,
     *  data：参数（默认：无）,
     *  callback：回调方法（默认：无）,
     *  isAuto：是否支持智能处理，如浮动信息、提示信息、页面跳转和数据填充等（默认：true）,
     *  appId : 模板id（非必填，若填写则自动进行数据填充）,
     *  buttonId：按钮id，事件触发后当前按钮便自动禁用，操作完成后即可启用（默认：无）,
     *  buttonText : 操作时的按钮信息（默认：按钮原信息+“...”）
     * }
     */
    $Ajax._ajax = function(params) {
        //判断是否是除登录外的url，如果是，必须传openid，否则直接返回
        var context = Supp.LocStorage.getVal(PLATFORM_AUTH_ID$CACHE);
  
        Supp.UI.openBusyToast();
        
        if (params.data == null) {
            params.data = {};
        }

        var _url = Supp_CONST.DOMAIN_URL + params.url;

        jq.ajax({
            "url" : _url,
            "params" : params,
            "type" : params.type,
            "data" : params.data,
            "cache" : false,
            "timeout" : TIME_OUT, //3分钟超时
            "beforeSend" : function(request) {
                var cookieValue = "";
                if (Supp.Platform.isWeiXin()) {
                    var openId = context ? context.openId : "";
                    if (openId != null && openId != "") {
                        request.setRequestHeader("openId", openId);
                    }
                } else if (Supp.Platform.isCpWeiXin()) {
                    var userId = context ? context.userId : "";
                    var tenantNo = context ? context.tenantNo : "";
                    if (userId != null && userId != "") {
                        request.setRequestHeader("userId", userId);
                        request.setRequestHeader("tenantNo", tenantNo);
                    }
                } else if (Supp.Platform.isDingTalk()) {
                    var userId = context ? context.userId : "";
                    var tenantNo = context ? context.tenantNo : "";
                    if (userId != null && userId != "") {
                        request.setRequestHeader("userId", userId);
                        request.setRequestHeader("tenantNo", tenantNo);
                    }
                }
            },
            "dataType" : (params.dataType == null ? "json" : params.dataType),
            "success" : function(resp) {

                if ( typeof (resp) == "string") {
                    resp = JSON.parse(resp);
                }

                if (resp.no_acc_binding && resp.no_acc_binding == "no_acc_binding") {
                         var BIND_ACCOUNT_HTML = "/wechat/meip/app/account_bind.html";
                         var page = {
                              data : BIND_ACCOUNT_HTML
                         };
                         Supp.UI.openWindow(page);
                         return;
                }

                if ($Ajax.checkLoginTimeout(resp)) {
                    console.log("登录超时退出app....");
                    $Ajax.intoLogonPage();
                    return;
                }

                try {
                    if (this.params.isAuto == null || this.params.isAuto === true) {
                        var msg = "";

                        try {
                            if (resp.msgCode && resp.msgCode != null && resp.msgCode != "") {
                                msg = Supp.I18N.prop(resp.msgCode);
                            } else {
                                msg = resp.message;
                            }
                        } catch (e) {
                            console.log("ajax.success处理msg时报错:", e);
                        }

                        if (msg != null && msg != "") {
                            if (resp.successful || resp.isSuccessful || resp.success) {
                                Supp.UI.openToast({
                                    "duration" : 3000,
                                    "msg" : msg
                                });
                            } else {
                                Supp.UI.openToast({
                                    "duration" : 5000,
                                    "msg" : msg
                                });
                            }
                        }

                    }
                    if (resp && resp.msgCode) {
                        if (resp.msgCode == "no_acc_binding") {
                            var BIND_ACCOUNT_HTML = "/wechat/meip/app/account_bind.html";
                            var page = {
                                data : BIND_ACCOUNT_HTML
                            };
                            Supp.UI.openWindow(page);
                            return;
                        }
                    }
                    if (this.params.callback != null) {
                        this.params.callback(resp);
                    }
                } finally {
                    Supp.UI.closeBusyToast();
                }
            },
            "error" : function(resp, status) {
                try {
                    if (window["getLog"] != null) {
                        console.log("ajax请求失败：url=" + this.url + ", params=" + JSON.stringify(this.data) + "resp=" + JSON.stringify(resp) + ", status=" + status);
                    }
                } catch (e) {
                }

                if ($Ajax.checkLoginTimeout(resp)) {
                    console.log("登录超时退出app....");
                    $Ajax.intoLogonPage();

                    return;
                }

                try {
                    var msg = "";
                    if (status == "timeout" && resp != null) {
                        resp.msgCode = "TIMEOUT";
                        msg = Supp.I18N.prop(resp.msgCode);
                    } else if (resp.msgCode != null) {
                        msg = Supp.I18N.prop(resp.msgCode);
                    } else if (resp.message != null) {
                        msg = resp.message;
                    } else {
                        resp.msgCode = "EXCEPTION_500";
                        msg = Supp.I18N.prop(resp.msgCode);
                    }

                    if (this.params.error == null && msg != null && msg != "") {
                        Supp.UI.openToast({
                            "duration" : 3000,
                            "msg" : msg
                        });
                    } else {
                        this.params.error(resp);
                    }
                } finally {
                    Supp.UI.closeBusyToast();
                }
            }
        });
    };

    /**
     * Ajax获取资源.
     *  GET方式提交。
     *
     * @params args {
     *  url : 地址（必填）,
     *  data：参数（默认：无）,
     *  callback：回调方法（默认：无）,
     *  isAuto：是否自动处理信息和页面跳转（默认：true）,
     *  buttonId：按钮id，事件触发后当前按钮便自动禁用，操作完成后即可启用（默认：无）,
     *  buttonText : 操作时的按钮信息（默认：按钮原信息+“...”）
     * }
     */
    $Ajax.get = function(args) {

        var TYPE = "get";
        var param = {
            "type" : TYPE
        };

        if (arguments.length == 1 && typeof (arguments[0]) != "string") {
            param = arguments[0];
            param.type = TYPE;
            param.isAuto = (arguments[0].isAuto == null ? true : arguments[0].isAuto);
        } else {
            param.url = arguments[0];
            param.callback = arguments[1];
            param.isAuto = (arguments[2] == null ? true : arguments[2]);
            param.buttonId = arguments[3];
            param.buttonText = arguments[4];
        }

        $Ajax._ajax(param);
    };

    /**
     * Ajax修改资源.
     * @params args {
     *  url : 地址（必填）,
     *  data：参数（默认：无）,
     *  callback：回调方法（默认：无）,
     *  isAuto：是否自动处理信息和页面跳转（默认：true）,
     *  buttonId：按钮id，事件触发后当前按钮便自动禁用，操作完成后即可启用（默认：无）,
     *  buttonText : 操作时的按钮信息（默认：按钮原信息+“...”）
     * }
     */
    $Ajax.update = function(args) {

        var TYPE = "post";
        var param = {
            "type" : TYPE
        };

        if (arguments.length == 1 && typeof (arguments[0]) != "string") {
            param = arguments[0];
            param.type = TYPE;
            param.isAuto = (arguments[0].isAuto == null ? true : arguments[0].isAuto);
        } else {
            param.url = arguments[0];
            param.data = arguments[1];
            param.callback = arguments[2];
            param.isAuto = (arguments[3] == null ? true : arguments[3]);
            param.buttonId = arguments[4];
            param.buttonText = arguments[5];
        }

        param.data = (param.data == null ? {} : param.data);
        param.data._method = "put";

        $Ajax._ajax(param);
    };

    /**
     * Ajax删除资源.
     * @params args {
     *  url : 地址（必填）,
     *  data：参数（默认：无）,
     *  callback：回调方法（默认：无）,
     *  isAuto：是否自动处理信息和页面跳转（默认：true）,
     *  buttonId：按钮id，事件触发后当前按钮便自动禁用，操作完成后即可启用（默认：无）,
     *  buttonText : 操作时的按钮信息（默认：按钮原信息+“...”）
     * }
     */
    $Ajax.del = function(args) {
        var TYPE = "delete";
        var param = {
            "type" : TYPE
        };

        if (arguments.length == 1 && typeof (arguments[0]) != "string") {
            param = arguments[0];
            param.type = TYPE;
            param.isAuto = (arguments[0].isAuto == null ? true : arguments[0].isAuto);
        } else {
            param.url = arguments[0];
            param.data = arguments[1];
            param.callback = arguments[2];
            param.isAuto = (arguments[3] == null ? true : arguments[3]);
            param.buttonId = arguments[4];
            param.buttonText = arguments[5];
        }

        $Ajax._ajax(param);
    };

    /**
     * Ajax加载页面.
     * @params container 存放新页面的元素（可以是对象，也可以是id名称）
     * @params url 请求地址
     */
    $Ajax.loadPage = function(container, url) {
        if ( typeof (container) == "string") {
            container = jq(container);
        }

        var SERVER_HOST = "";

        if ($Ajax.useRemoteServer()) {
            try {
                SERVER_HOST = Supp.MEIP.getContext().server.serverAddr;
            } catch (e) {
            }
        } else {
            SERVER_HOST = Supp.MEIP.getBaseDir();
        }

        container.load(SERVER_HOST + url);
    };

    /**
     * Ajax加载数据.
     * @params url 请求地址
     * @params formId 将加载到的数据填充到form表单元素中（根据属性名进行匹配）
     */
    $Ajax.loadData = function(url, formId) {
        $Ajax._ajax({
            "type" : "get",
            "url" : url,
            "isAuto" : false,
            "callback" : function(result) {
                var data = result.body;

                if (data != null) {
                    if (formId != null) {
                        jq("#" + formId).fill(data);
                    } else {
                        for (var p in data) {
                            jq("#" + p).val(data[p]);
                        }
                    }
                }
            }
        });
    };

    /**
     * ajax提交数据.
     * @params args {
     *  url : 地址（必填）,
     *  data：参数（默认：无）,
     *  callback：回调方法（默认：无）,
     *  isAuto：是否自动处理信息和页面跳转（默认：true）,
     *  buttonId：按钮id，事件触发后当前按钮便自动禁用，操作完成后即可启用（默认：无）,
     *  buttonText : 操作时的按钮信息（默认：按钮原信息+“...”）
     * }
     */
    $Ajax.submit = function(url, data, callback, isAuto, buttonId, buttonText) {

        var TYPE = "post";
        var param = {
            "type" : TYPE
        };

        if (arguments.length == 1 && typeof (arguments[0]) != "string") {
            param = arguments[0];
            param.type = TYPE;

            if (arguments[0].form != null && typeof (arguments[0].form) == "string") {
                param.data = jq(arguments[0].form.indexOf(".") > -1 ? arguments[0].form : "#" + arguments[0].form).serialize();
            }

            param.isAuto = (arguments[0].isAuto == null ? true : arguments[0].isAuto);
        } else {
            param.url = arguments[0];

            if (data != null && typeof (data) == "string") {
                param.data = jq(data.indexOf(".") > -1 ? data : "#" + data).serialize();
            } else {
                param.data = data;
            }

            param.callback = callback;
            param.isAuto = (isAuto == null ? true : isAuto);
            param.buttonId = buttonId;
            param.buttonText = buttonText;
        }

        $Ajax._ajax(param);
    };

})(Supp.Base, "Supp.Ajax");


/*
 ajax工具
 */
Supp.ajax = function(params) {
        var TIME_OUT = 1000 * 60 * 2;
        //判断是否是除登录外的url，如果是，必须传openid，否则直接返回
        var context = Supp.LocStorage.getVal(PLATFORM_AUTH_ID$CACHE);
  
        Supp.UI.openBusyToast();
        
        if (params.data == null) {
            params.data = {};
        }

        var _url = Supp_CONST.DOMAIN_URL + params.url;

        jq.ajax({
            "url" : _url,
            "params" : params,
            "type" : params.type,
            "data" : params.data,
            "cache" : false,
            "timeout" : TIME_OUT, //3分钟超时
            "beforeSend" : function(request) {
                var cookieValue = "";
                if (Supp.Platform.isWeiXin()) {
                    var openId = "";
                    if(IS_DEBUG == 0){
                        openId = context ? context.openId : "";
                    }
                    else{
                        openId = "oeMMEuBPI9aOF1Y6yMmz9padFhv0";
                        var _context = {
                            "openId" : openId
                        };
                        Supp.LocStorage.setVal(PLATFORM_AUTH_ID$CACHE, _context);
                    } 
                    if (openId != null && openId != "") {
                        request.setRequestHeader("openId", openId);
                    }
                } else if (Supp.Platform.isCpWeiXin()) {
                    var userId = context ? context.userId : "";
                    var tenantNo = context ? context.tenantNo : "";
                    if (userId != null && userId != "") {
                        request.setRequestHeader("userId", userId);
                        request.setRequestHeader("tenantNo", tenantNo);
                    }
                } else if (Supp.Platform.isDingTalk()) {
                    var userId = context ? context.userId : "";
                    var tenantNo = context ? context.tenantNo : "";
                    if (userId != null && userId != "") {
                        request.setRequestHeader("userId", userId);
                        request.setRequestHeader("tenantNo", tenantNo);
                    }
                }
            },
            "dataType" : (params.dataType == null ? "json" : params.dataType),
            "success" : function(resp) {

                if ( typeof (resp) == "string") {
                    resp = JSON.parse(resp);
                }

                if (resp.body && resp.body.no_acc_binding && resp.body.no_acc_binding == "no_acc_binding") {
                         var BIND_ACCOUNT_HTML = "/wechat/meip/app/account_bind.html";
                         var page = {
                              data : BIND_ACCOUNT_HTML
                         };
                         Supp.UI.openWindow(page);
                         return;
                }

                if (Supp.Ajax.checkLoginTimeout(resp)) {
                    console.log("登录超时退出app....");
                    Supp.Ajax.intoLogonPage();
                    return;
                }

                try {
                    if (this.params.isAuto == null || this.params.isAuto === true) {
                        var msg = "";

                        try {
                            if (resp.msgCode && resp.msgCode != null && resp.msgCode != "") {
                                msg = Supp.I18N.prop(resp.msgCode);
                            } else {
                                msg = resp.message;
                            }
                        } catch (e) {
                            console.log("ajax.success处理msg时报错:", e);
                        }

                        if (msg != null && msg != "") {
                            if (resp.successful || resp.isSuccessful || resp.success) {
                                Supp.UI.openToast({
                                    "duration" : 3000,
                                    "msg" : msg
                                });
                            } else {
                                Supp.UI.openToast({
                                    "duration" : 5000,
                                    "msg" : msg
                                });
                            }
                        }

                    }
                    if (resp && resp.msgCode) {
                        if (resp.msgCode == "no_acc_binding") {
                            var BIND_ACCOUNT_HTML = "/wechat/meip/app/account_bind.html";
                            var page = {
                                data : BIND_ACCOUNT_HTML
                            };
                            Supp.UI.openWindow(page);
                            return;
                        }
                    }
                    if (this.params.success != null) {
                        this.params.success(resp);
                    }
                } finally {
                    Supp.UI.closeBusyToast();
                }
            },
            "error" : function(resp, status) {
                try {
                    if (window["getLog"] != null) {
                        console.log("ajax请求失败：url=" + this.url + ", params=" + JSON.stringify(this.data) + "resp=" + JSON.stringify(resp) + ", status=" + status);
                    }
                } catch (e) {
                }

                if (Supp.Ajax.checkLoginTimeout(resp)) {
                    console.log("登录超时退出app....");
                    Supp.Ajax.intoLogonPage();

                    return;
                }

                try {
                    var msg = "";
                    if (status == "timeout" && resp != null) {
                        resp.msgCode = "TIMEOUT";
                        msg = Supp.I18N.prop(resp.msgCode);
                    } else if (resp.msgCode != null) {
                        msg = Supp.I18N.prop(resp.msgCode);
                    } else if (resp.message != null) {
                        msg = resp.message;
                    } else {
                        resp.msgCode = "EXCEPTION_500";
                        msg = Supp.I18N.prop(resp.msgCode);
                    }

                    if (this.params.error == null && msg != null && msg != "") {
                        Supp.UI.openToast({
                            "duration" : 3000,
                            "msg" : msg
                        });
                    } else {
                        this.params.error(resp);
                    }
                } finally {
                    Supp.UI.closeBusyToast();
                }
            }
        });
}/**
 * Supp UI 工具.
 *
 * @Creator      : DangQingyao
 * @Create Date  : 2017-5-3
 * @Since        : 06.00.0000
 * Modifier      :
 * Modified Date :
 * @Dependences  : supp-base.js, supp-log.js
 * @Description  :
 */

//~ Fields
// ====================================================================================================================
//
//默认字体
var Supp_MEIP_FONT4CACHE_KEY = "Supp_MEIP_FONT";

//默认皮肤样式
var Supp_MEIP_STYLE4CACHE_KEY = "Supp_MEIP_STYLE";

//当前使用的语言
var Supp_CURRENT_LANGUAGE$CACHE = "SHARE$CURRENT_LANGUAGE";

//顶层目录
var Supp_MEIP_BASE_DIR4WINDOW = "Supp_MEIP_BASE_DIR";

//环境上下文KEY名
var Supp_CURRENT_CONTEXT$CACHE = "SHARE$CURRENT_CONTEXT";

//~ Event Functions
// ====================================================================================================================

//~ Public Functions
// ====================================================================================================================

/**
 * Supp移动UI工具.
 */
(function(parentObj, parentNames) {
    var mEIP = parentObj.create(parentNames);

    var MEIP_ID$CACHE = "MEIP_ID";
    var MEIP_INFO$CACHE = "MEIP_APP_INFO";
    var WIDGET_APP_INFO$CACHE = "WIDGET_APP_INFO";
    var PHONE_EQUIPMENT = "PHONE_EQUIPMENT";

    /**
     * 获取当前显示名称.
     */
    mEIP.getDisplayName = function(nameZh, nameEn, name3, name4) {
        try {
            var lang = Supp.MEIP.getContext().language;

            if (lang == null) {
                return nameZh;
            } else if (lang.index == 2) {
                return nameEn;
            } else if (lang.index == 3) {
                return name3;
            } else if (lang.index == 4) {
                return name4;
            }
        } catch (e) {

        }

        return nameZh;
    };

    /**
     * 设置当前使用的服务器信息.
     * @param context 上下文信息
     * {
     *  tenant : 当前租户（即企业标识）,
     *  server : 服务器信息{ serverAddr : 服务器地址,  serverName : 服务器名称 },
     *  desktop : 工作平台信息 { desktopId : 工作平台id, nameZh : 中文名, nameEn : 英文名, name3... },
     *  account : 账号信息 { empId : 员工ID, empIcon : 员工头像, empName : 员工名称, accountId : 账号ID, accountName : 账号名称（即登录账号） },
     *  employee : 员工信息,
     *  bmYear : 登录年库,
     *  language : 当前使用的多国语言代码,
     *  skinStyle : 当前使用的皮肤,
     *  fontSize : 当期使用的字号
     * }
     */
    mEIP.setContext = function(context) {
        var cacheContext = Supp.LocStorage.getSysVal(Supp_CURRENT_CONTEXT$CACHE);

        if (cacheContext == null || cacheContext == "") {
            cacheContext = {};
        } else {
            cacheContext = JSON.parse(cacheContext);
        }

        if (context.server) {
            cacheContext.tenant = context.server.tenant;
        }

        if (context.server === null || context.server === "") {
            delete cacheContext.server;
        } else if (context.server) {
            cacheContext.server = context.server;
        }

        if (context.desktop === null || context.desktop === "") {
            delete cacheContext.desktop;
        } else if (context.desktop) {
            cacheContext.desktop = context.desktop;
        }

        if (context.account === null || context.account === "") {
            delete cacheContext.account;
        } else if (context.account) {
            cacheContext.account = context.account;
        }

        if (context.employee) {
            cacheContext.employee = context.employee;
        }

        if (context.company) {
            cacheContext.company = context.company;
        }

        if (context.bmYear) {
            cacheContext.bmYear = context.bmYear;
        }
        if (context.language) {
            cacheContext.language = context.language;
        }
        if (context.skinStyle) {
            cacheContext.skinStyle = context.skinStyle;
        }
        if (context.fontSize) {
            cacheContext.fontSize = context.fontSize;
        }

        Supp.LocStorage.setSysVal(Supp_CURRENT_CONTEXT$CACHE, JSON.stringify(cacheContext));
    };

    /**
     * 获取环境上下文信息.
     */
    mEIP.getContext = function() {
        var context = null;
        var cacheContext = Supp.LocStorage.getSysVal(Supp_CURRENT_CONTEXT$CACHE);
        if (cacheContext == null || cacheContext == "") {
            context = { };
        } else {
            context = JSON.parse(cacheContext);
        }

        return context;
    };

    /**
     * 设置顶层目录.
     * 当前页面如何返回顶层目录，比如传入“../../”
     *
     * @path 顶层目录
     */
    mEIP.setBaseDir = function(path) {
        window[Supp_MEIP_BASE_DIR4WINDOW] = (path == null ? "" : path);
    };
    mEIP.getBaseDir = function() {
        var baseDir = window[Supp_MEIP_BASE_DIR4WINDOW];

        if (baseDir != null && baseDir != "") {
            return baseDir;
        } else if (window["getAppSystemBaseDir"] != null) {
            return window["getAppSystemBaseDir"]();
        }

        return "";
    };

    mEIP.combinedUrl = function(path) {
        path = ( path ? path : "");
        var context = Supp.LocStorage.getVal(PLATFORM_AUTH_ID$CACHE);
        if(path.indexOf("?") > 0){
            path = path + "&";
        }
        else{
            path = path + "?";
        }
        
        if (Supp.Platform.isWeiXin()) {
            path = path + "openId="+context.openId;
        } else if (Supp.Platform.isCpWeiXin()) { 
            var userId = context ? context.userId : "";
            var tenantNo = context ? context.tenantNo : "";
            path = path + "userId=" + userId + "&tenantNo=" + tenantNo;
        } else if (Supp.Platform.isDingTalk()) { 
            var userId = context ? context.userId : "";
            var tenantNo = context ? context.tenantNo : "";
            path = path + "userId=" + userId + "&tenantNo=" + tenantNo;
        }
        return Supp_CONST.DOMAIN_URL + path;

    };

    /**
     * 设置、获取消息推送.
     * @param enabled 是否启用
     */
    mEIP.enableMessagePush = function(enabled) {
        var ENABLE_MESSAGE_PUSH$CACHE = "ENABLE_MESSAGE_PUSH";

        if (enabled == null) {
            var val = Supp.LocStorage.getPubVal(ENABLE_MESSAGE_PUSH$CACHE);
            return (val == null ? true : val);
        } else {
            Supp.LocStorage.setPubVal(ENABLE_MESSAGE_PUSH$CACHE, enabled);
        }
    };

    /**
     * 设置、获取应用消息角标.
     * @param enabled 是否启用
     */
    mEIP.enableBadgeNumber = function(enabled) {
        var ENABLE_BADGE_NUMBER$CACHE = "ENABLE_BADGE_NUMBER";

        if (enabled == null) {
            var val = Supp.LocStorage.getPubVal(ENABLE_BADGE_NUMBER$CACHE);
            return (val == null ? true : val);
        } else {
            Supp.LocStorage.setPubVal(ENABLE_BADGE_NUMBER$CACHE, enabled);
        }
    };
})(Supp.Base, "Supp.MEIP");
/**
 * Supp移动UI工具.
 */
(function(parentObj, parentNames) {
    var $help = parentObj.create(parentNames);

    //是否显示新手指导
    $help.isGuideVisible = function() {
        var visible = Supp.LocStorage.getPubVal($help.getGuidePageCacheKey());
        return (visible == null || visible === true);
    };

    //设置可见性，默认false
    $help.setGuideVisible = function(val) {
        setTimeout(function() {
            Supp.LocStorage.setPubVal($help.getGuidePageCacheKey(), val ? val : false);
        }, 1000);
    };

    //获取页面指导缓存名
    $help.getGuidePageCacheKey = function(pageName) {
        var returnPageName = ( pageName ? pageName : Supp.UI.getPageName());
        var index = returnPageName.indexOf("_content");

        return "GUIDE_VISIBLE-" + (index > -1 ? returnPageName.substring(0, index) : returnPageName);
    };

    $help.startMultiGuide = function(complete, isForce) {
        if (window["introJs"] != null) {
            var pageCacheKey = $help.getGuidePageCacheKey();
            var guideVisible = Supp.LocStorage.getPubVal(pageCacheKey);

            // if (isForce == true || guideVisible == null || guideVisible == true) {
            Supp.LocStorage.setPubVal(pageCacheKey, false);

            if (complete) {

                var introObj = introJs().setOption('doneLabel', Supp.I18N.prop("help-guide-nextPage"));

                introObj.oncomplete(complete);
                introObj.onexit(complete);
                introObj.start();
            } else {
                introJs().start();
            }
            // }
        }
    };

    $help.startGuide = function(isForce) {
        $help.startMultiGuide(null, isForce);
    };
})(Supp.Base, "Supp.Help");
/**
 * 选择列表插件
 * varstion 2.0.0
 * by Houfeng
 * Houfeng@DCloud.io
 */

(function($, window, document, undefined) {

	var MAX_EXCEED = 30;
	var VISIBLE_RANGE = 90;
	var DEFAULT_ITEM_HEIGHT = 40;
	var BLUR_WIDTH = 10;

	var rad2deg = $.rad2deg = function(rad) {
		return rad / (Math.PI / 180);
	};

	var deg2rad = $.deg2rad = function(deg) {
		return deg * (Math.PI / 180);
	};

	var platform = navigator.platform.toLowerCase();
	var userAgent = navigator.userAgent.toLowerCase();
	var isIos = (userAgent.indexOf('iphone') > -1 ||
			userAgent.indexOf('ipad') > -1 ||
			userAgent.indexOf('ipod') > -1) &&
		(platform.indexOf('iphone') > -1 ||
			platform.indexOf('ipad') > -1 ||
			platform.indexOf('ipod') > -1);
	//alert(isIos);

	var Picker = $.Picker = function(holder, options) {
		var self = this;
		self.holder = holder;
		self.options = options || {};
		self.init();
		self.initInertiaParams();
		self.calcElementItemPostion(true);
		self.bindEvent();
	};

	Picker.prototype.findElementItems = function() {
		var self = this;
		self.elementItems = [].slice.call(self.holder.querySelectorAll('li'));
		return self.elementItems;
	};

	Picker.prototype.init = function() {
		var self = this;
		self.list = self.holder.querySelector('ul');
		self.findElementItems();
		self.height = self.holder.offsetHeight;
		self.r = self.height / 2 - BLUR_WIDTH;
		self.d = self.r * 2;
		self.itemHeight = self.elementItems.length > 0 ? self.elementItems[0].offsetHeight : DEFAULT_ITEM_HEIGHT;
		self.itemAngle = parseInt(self.calcAngle(self.itemHeight * 0.8));
		self.hightlightRange = self.itemAngle / 2;
		self.visibleRange = VISIBLE_RANGE;
		self.beginAngle = 0;
		self.beginExceed = self.beginAngle - MAX_EXCEED;
		self.list.angle = self.beginAngle;
		if (isIos) {
			self.list.style.webkitTransformOrigin = "center center " + self.r + "px";
		}
	};

	Picker.prototype.calcElementItemPostion = function(andGenerateItms) {
		var self = this;
		if (andGenerateItms) {
			self.items = [];
		}
		self.elementItems.forEach(function(item) {
			var index = self.elementItems.indexOf(item);
			self.endAngle = self.itemAngle * index;
			item.angle = self.endAngle;
			item.style.webkitTransformOrigin = "center center -" + self.r + "px";
			item.style.webkitTransform = "translateZ(" + self.r + "px) rotateX(" + (-self.endAngle) + "deg)";
			if (andGenerateItms) {
				var dataItem = {};
				dataItem.text = item.innerHTML || '';
				dataItem.value = item.getAttribute('data-value') || dataItem.text;
				self.items.push(dataItem);
			}
		});
		self.endExceed = self.endAngle + MAX_EXCEED;
		self.calcElementItemVisibility(self.beginAngle);
	};

	Picker.prototype.calcAngle = function(c) {
		var self = this;
		var a = b = parseFloat(self.r);
		//直径的整倍数部分直接乘以 180
		c = Math.abs(c); //只算角度不关心正否值
		var intDeg = parseInt(c / self.d) * 180;
		c = c % self.d;
		//余弦
		var cosC = (a * a + b * b - c * c) / (2 * a * b);
		var angleC = intDeg + rad2deg(Math.acos(cosC));
		return angleC;
	};

	Picker.prototype.calcElementItemVisibility = function(angle) {
		var self = this;
		self.elementItems.forEach(function(item) {
			var difference = Math.abs(item.angle - angle);
			if (difference < self.hightlightRange) {
				item.classList.add('highlight');
			} else if (difference < self.visibleRange) {
				item.classList.add('visible');
				item.classList.remove('highlight');
			} else {
				item.classList.remove('highlight');
				item.classList.remove('visible');
			}
		});
	};

	Picker.prototype.setAngle = function(angle) {
		var self = this;
		self.list.angle = angle;
		self.list.style.webkitTransform = "perspective(1000px) rotateY(0deg) rotateX(" + angle + "deg)";
		self.calcElementItemVisibility(angle);
	};

	Picker.prototype.bindEvent = function() {
		var self = this;
		var lastAngle = 0;
		var startY = null;
		var isPicking = false;
		self.holder.addEventListener($.EVENT_START, function(event) {
			isPicking = true;
			event.preventDefault();
			self.list.style.webkitTransition = '';
			startY = (event.changedTouches ? event.changedTouches[0] : event).pageY;
			lastAngle = self.list.angle;
			self.updateInertiaParams(event, true);
		}, false);
		self.holder.addEventListener($.EVENT_END, function(event) {
			isPicking = false;
			event.preventDefault();
			self.startInertiaScroll(event);
		}, false);
		self.holder.addEventListener($.EVENT_CANCEL, function(event) {
			isPicking = false;
			event.preventDefault();
			self.startInertiaScroll(event);
		}, false);
		self.holder.addEventListener($.EVENT_MOVE, function(event) {
			if (!isPicking) {
				return;
			}
			event.preventDefault();
			var endY = (event.changedTouches ? event.changedTouches[0] : event).pageY;
			var dragRange = endY - startY;
			var dragAngle = self.calcAngle(dragRange);
			var newAngle = dragRange > 0 ? lastAngle - dragAngle : lastAngle + dragAngle;
			if (newAngle > self.endExceed) {
				newAngle = self.endExceed
			}
			if (newAngle < self.beginExceed) {
				newAngle = self.beginExceed
			}
			self.setAngle(newAngle);
			self.updateInertiaParams(event);
		}, false);
		//--
		self.list.addEventListener('tap', function(event) {
			elementItem = event.target;
			if (elementItem.tagName == 'LI') {
				self.setSelectedIndex(self.elementItems.indexOf(elementItem), 200);
			}
		}, false);
	};

	Picker.prototype.initInertiaParams = function() {
		var self = this;
		self.lastMoveTime = 0;
		self.lastMoveStart = 0;
		self.stopInertiaMove = false;
	};

	Picker.prototype.updateInertiaParams = function(event, isStart) {
		var self = this;
		var point = event.changedTouches ? event.changedTouches[0] : event;
		if (isStart) {
			self.lastMoveStart = point.pageY;
			self.lastMoveTime = event.timeStamp || Date.now();
			self.startAngle = self.list.angle;
		} else {
			var nowTime = event.timeStamp || Date.now();
			if (nowTime - self.lastMoveTime > 300) {
				self.lastMoveTime = nowTime;
				self.lastMoveStart = point.pageY;
			}
		}
		self.stopInertiaMove = true;
	};

	Picker.prototype.startInertiaScroll = function(event) {
		var self = this;
		var point = event.changedTouches ? event.changedTouches[0] : event;
		/** 
		 * 缓动代码
		 */
		var nowTime = event.timeStamp || Date.now();
		var v = (point.pageY - self.lastMoveStart) / (nowTime - self.lastMoveTime); //最后一段时间手指划动速度  
		var dir = v > 0 ? -1 : 1; //加速度方向  
		var deceleration = dir * 0.0006 * -1;
		var duration = Math.abs(v / deceleration); // 速度消减至0所需时间  
		var dist = v * duration / 2; //最终移动多少 
		var startAngle = self.list.angle;
		var distAngle = self.calcAngle(dist) * dir;
		//----
		var srcDistAngle = distAngle;
		if (startAngle + distAngle < self.beginExceed) {
			distAngle = self.beginExceed - startAngle;
			duration = duration * (distAngle / srcDistAngle) * 0.6;
		}
		if (startAngle + distAngle > self.endExceed) {
			distAngle = self.endExceed - startAngle;
			duration = duration * (distAngle / srcDistAngle) * 0.6;
		}
		//----
		if (distAngle == 0) {
			self.endScroll();
			return;
		}
		self.scrollDistAngle(nowTime, startAngle, distAngle, duration);
	};

	Picker.prototype.scrollDistAngle = function(nowTime, startAngle, distAngle, duration) {
		var self = this;
		self.stopInertiaMove = false;
		(function(nowTime, startAngle, distAngle, duration) {
			var frameInterval = 13;
			var stepCount = duration / frameInterval;
			var stepIndex = 0;
			(function inertiaMove() {
				if (self.stopInertiaMove) return;
				var newAngle = self.quartEaseOut(stepIndex, startAngle, distAngle, stepCount);
				self.setAngle(newAngle);
				stepIndex++;
				if (stepIndex > stepCount - 1 || newAngle < self.beginExceed || newAngle > self.endExceed) {
					self.endScroll();
					return;
				}
				setTimeout(inertiaMove, frameInterval);
			})();
		})(nowTime, startAngle, distAngle, duration);
	};

	Picker.prototype.quartEaseOut = function(t, b, c, d) {
		return -c * ((t = t / d - 1) * t * t * t - 1) + b;
	};

	Picker.prototype.endScroll = function() {
		var self = this;
		if (self.list.angle < self.beginAngle) {
			self.list.style.webkitTransition = "150ms ease-out";
			self.setAngle(self.beginAngle);
		} else if (self.list.angle > self.endAngle) {
			self.list.style.webkitTransition = "150ms ease-out";
			self.setAngle(self.endAngle);
		} else {
			var index = parseInt((self.list.angle / self.itemAngle).toFixed(0));
			self.list.style.webkitTransition = "100ms ease-out";
			self.setAngle(self.itemAngle * index);
		}
		self.triggerChange();
	};

	Picker.prototype.triggerChange = function(force) {
		var self = this;
		setTimeout(function() {
			var index = self.getSelectedIndex();
			var item = self.items[index];
			if ($.trigger && (index != self.lastIndex || force === true)) {
				$.trigger(self.holder, 'change', {
					"index": index,
					"item": item
				});
				//console.log('change:' + index);
			}
			self.lastIndex = index;
			typeof force === 'function' && force();
		}, 0);
	};

	Picker.prototype.correctAngle = function(angle) {
		var self = this;
		if (angle < self.beginAngle) {
			return self.beginAngle;
		} else if (angle > self.endAngle) {
			return self.endAngle;
		} else {
			return angle;
		}
	};

	Picker.prototype.setItems = function(items) {
		var self = this;
		self.items = items || [];
		var buffer = [];
		self.items.forEach(function(item) {
			if (item !== null && item !== undefined) {
				buffer.push('<li>' + (item.text || item) + '</li>');
			}
		});
		self.list.innerHTML = buffer.join('');
		self.findElementItems();
		self.calcElementItemPostion();
		self.setAngle(self.correctAngle(self.list.angle));
		self.triggerChange(true);
	};

	Picker.prototype.getItems = function() {
		var self = this;
		return self.items;
	};

	Picker.prototype.getSelectedIndex = function() {
		var self = this;
		return parseInt((self.list.angle / self.itemAngle).toFixed(0));
	};

	Picker.prototype.setSelectedIndex = function(index, duration, callback) {
		var self = this;
		self.list.style.webkitTransition = '';
		var angle = self.correctAngle(self.itemAngle * index);
		if (duration && duration > 0) {
			var distAngle = angle - self.list.angle;
			self.scrollDistAngle(Date.now(), self.list.angle, distAngle, duration);
		} else {
			self.setAngle(angle);
		}
		self.triggerChange(callback);
	};

	Picker.prototype.getSelectedItem = function() {
		var self = this;
		return self.items[self.getSelectedIndex()];
	};

	Picker.prototype.getSelectedValue = function() {
		var self = this;
		return (self.items[self.getSelectedIndex()] || {}).value;
	};

	Picker.prototype.getSelectedText = function() {
		var self = this;
		return (self.items[self.getSelectedIndex()] || {}).text;
	};

	Picker.prototype.setSelectedValue = function(value, duration, callback) {
		var self = this;
		for (var index in self.items) {
			var item = self.items[index];
			if (item.value == value) {
				self.setSelectedIndex(index, duration, callback);
				return;
			}
		}
	};

	if ($.fn) {
		$.fn.picker = function(options) {
			//遍历选择的元素
			this.each(function(i, element) {
				if (element.picker) return;
				if (options) {
					element.picker = new Picker(element, options);
				} else {
					var optionsText = element.getAttribute('data-picker-options');
					var _options = optionsText ? JSON.parse(optionsText) : {};
					element.picker = new Picker(element, _options);
				}
			});
			return this[0] ? this[0].picker : null;
		};

		//自动初始化
		$.ready(function() {
			$('.mui-picker').picker();
		});
	}

})(window.mui || window, window, document, undefined);
//end
/**
 * 弹出选择列表插件
 * 此组件依赖 listpcker ，请在页面中先引入 mui.picker.css + mui.picker.js
 * varstion 1.0.1
 * by Houfeng
 * Houfeng@DCloud.io
 */

(function($, document) {

	//创建 DOM
	$.dom = function(str) {
		if (typeof(str) !== 'string') {
			if ((str instanceof Array) || (str[0] && str.length)) {
				return [].slice.call(str);
			} else {
				return [str];
			}
		}
		if (!$.__create_dom_div__) {
			$.__create_dom_div__ = document.createElement('div');
		}
		$.__create_dom_div__.innerHTML = str;
		return [].slice.call($.__create_dom_div__.childNodes);
	};

	var panelBuffer = '<div class="mui-poppicker">\
		<div class="mui-poppicker-header">\
			<button class="mui-btn mui-poppicker-btn-cancel">取消</button>\
			<button class="mui-btn mui-btn-blue mui-poppicker-btn-ok">确定</button>\
			<div class="mui-poppicker-clear"></div>\
		</div>\
		<div class="mui-poppicker-body">\
		</div>\
	</div>';

	var pickerBuffer = '<div class="mui-picker">\
		<div class="mui-picker-inner">\
			<div class="mui-pciker-rule mui-pciker-rule-ft"></div>\
			<ul class="mui-pciker-list">\
			</ul>\
			<div class="mui-pciker-rule mui-pciker-rule-bg"></div>\
		</div>\
	</div>';

	//定义弹出选择器类
	var PopPicker = $.PopPicker = $.Class.extend({
		//构造函数
		init: function(options) {
			var self = this;
			self.options = options || {};
			self.options.buttons = self.options.buttons || ['取消', '确定'];
			self.panel = $.dom(panelBuffer)[0];
			document.body.appendChild(self.panel);
			self.ok = self.panel.querySelector('.mui-poppicker-btn-ok');
			self.cancel = self.panel.querySelector('.mui-poppicker-btn-cancel');
			self.body = self.panel.querySelector('.mui-poppicker-body');
			self.mask = $.createMask();
			self.cancel.innerText = self.options.buttons[0];
			self.ok.innerText = self.options.buttons[1];
			self.cancel.addEventListener('tap', function(event) {
				self.hide();
			}, false);
			self.ok.addEventListener('tap', function(event) {
				if (self.callback) {
					var rs = self.callback(self.getSelectedItems());
					if (rs !== false) {
						self.hide();
					}
				}
			}, false);
			self.mask[0].addEventListener('tap', function() {
				self.hide();
			}, false);
			self._createPicker();
			//防止滚动穿透
			self.panel.addEventListener($.EVENT_START, function(event) {
				event.preventDefault();
			}, false);
			self.panel.addEventListener($.EVENT_MOVE, function(event) {
				event.preventDefault();
			}, false);
		},
		_createPicker: function() {
			var self = this;
			var layer = self.options.layer || 1;
			var width = (100 / layer) + '%';
			self.pickers = [];
			for (var i = 1; i <= layer; i++) {
				var pickerElement = $.dom(pickerBuffer)[0];
				pickerElement.style.width = width;
				self.body.appendChild(pickerElement);
				var picker = $(pickerElement).picker();
				self.pickers.push(picker);
				pickerElement.addEventListener('change', function(event) {
					var nextPickerElement = this.nextSibling;
					if (nextPickerElement && nextPickerElement.picker) {
						var eventData = event.detail || {};
						var preItem = eventData.item || {};
						nextPickerElement.picker.setItems(preItem.children);
					}
				}, false);
			}
		},
		//填充数据
		setData: function(data) {
			var self = this;
			data = data || [];
			self.pickers[0].setItems(data);
		},
		//获取选中的项（数组）
		getSelectedItems: function() {
			var self = this;
			var items = [];
			for (var i in self.pickers) {
				var picker = self.pickers[i];
				items.push(picker.getSelectedItem() || {});
			}
			return items;
		},
		//显示
		show: function(callback) {
			var self = this;
			self.callback = callback;
			self.mask.show();
			document.body.classList.add($.className('poppicker-active-for-page'));
			self.panel.classList.add($.className('active'));
			//处理物理返回键
			self.__back = $.back;
			$.back = function() {
				self.hide();
			};
		},
		//隐藏
		hide: function() {
			var self = this;
			if (self.disposed) return;
			self.panel.classList.remove($.className('active'));
			self.mask.close();
			document.body.classList.remove($.className('poppicker-active-for-page'));
			//处理物理返回键
			$.back=self.__back;
		},
		dispose: function() {
			var self = this;
			self.hide();
			setTimeout(function() {
				self.panel.parentNode.removeChild(self.panel);
				for (var name in self) {
					self[name] = null;
					delete self[name];
				};
				self.disposed = true;
			}, 300);
		}
	});

})(mui, document);
/**
 * 日期时间插件
 * varstion 1.0.5
 * by Houfeng
 * Houfeng@DCloud.io
 */

(function($, document) {

	//创建 DOM
	$.dom = function(str) {
		if (typeof(str) !== 'string') {
			if ((str instanceof Array) || (str[0] && str.length)) {
				return [].slice.call(str);
			} else {
				return [str];
			}
		}
		if (!$.__create_dom_div__) {
			$.__create_dom_div__ = document.createElement('div');
		}
		$.__create_dom_div__.innerHTML = str;
		return [].slice.call($.__create_dom_div__.childNodes);
	};

	var domBuffer = '<div class="mui-dtpicker" data-type="datetime">\
		<div class="mui-dtpicker-header">\
			<button data-id="btn-cancel" class="mui-btn">取消</button>\
			<button data-id="btn-ok" class="mui-btn mui-btn-blue">确定</button>\
		</div>\
		<div class="mui-dtpicker-title"><h5 data-id="title-y">年</h5><h5 data-id="title-m">月</h5><h5 data-id="title-d">日</h5><h5 data-id="title-h">时</h5><h5 data-id="title-i">分</h5></div>\
		<div class="mui-dtpicker-body">\
			<div data-id="picker-y" class="mui-picker">\
				<div class="mui-picker-inner">\
					<div class="mui-pciker-rule mui-pciker-rule-ft"></div>\
					<ul class="mui-pciker-list">\
					</ul>\
					<div class="mui-pciker-rule mui-pciker-rule-bg"></div>\
				</div>\
			</div>\
			<div data-id="picker-m" class="mui-picker">\
				<div class="mui-picker-inner">\
					<div class="mui-pciker-rule mui-pciker-rule-ft"></div>\
					<ul class="mui-pciker-list">\
					</ul>\
					<div class="mui-pciker-rule mui-pciker-rule-bg"></div>\
				</div>\
			</div>\
			<div data-id="picker-d" class="mui-picker">\
				<div class="mui-picker-inner">\
					<div class="mui-pciker-rule mui-pciker-rule-ft"></div>\
					<ul class="mui-pciker-list">\
					</ul>\
					<div class="mui-pciker-rule mui-pciker-rule-bg"></div>\
				</div>\
			</div>\
			<div data-id="picker-h" class="mui-picker">\
				<div class="mui-picker-inner">\
					<div class="mui-pciker-rule mui-pciker-rule-ft"></div>\
					<ul class="mui-pciker-list">\
					</ul>\
					<div class="mui-pciker-rule mui-pciker-rule-bg"></div>\
				</div>\
			</div>\
			<div data-id="picker-i" class="mui-picker">\
				<div class="mui-picker-inner">\
					<div class="mui-pciker-rule mui-pciker-rule-ft"></div>\
					<ul class="mui-pciker-list">\
					</ul>\
					<div class="mui-pciker-rule mui-pciker-rule-bg"></div>\
				</div>\
			</div>\
		</div>\
	</div>';

	//plugin
	var DtPicker = $.DtPicker = $.Class.extend({
		init: function(options) {
			var self = this;
			var _picker = $.dom(domBuffer)[0];
			document.body.appendChild(_picker);
			$('[data-id*="picker"]', _picker).picker();
			var ui = self.ui = {
				picker: _picker,
				mask: $.createMask(),
				ok: $('[data-id="btn-ok"]', _picker)[0],
				cancel: $('[data-id="btn-cancel"]', _picker)[0],
				y: $('[data-id="picker-y"]', _picker)[0],
				m: $('[data-id="picker-m"]', _picker)[0],
				d: $('[data-id="picker-d"]', _picker)[0],
				h: $('[data-id="picker-h"]', _picker)[0],
				i: $('[data-id="picker-i"]', _picker)[0],
				labels: $('[data-id*="title-"]', _picker),
			};
			ui.cancel.addEventListener('tap', function() {
				self.hide();
			}, false);
			ui.ok.addEventListener('tap', function() {
				var rs = self.callback(self.getSelected());
				if (rs !== false) {
					self.hide();
				}
			}, false);
			ui.y.addEventListener('change', function(e) { //目前的change事件容易导致级联触发
				if (self.options.beginMonth || self.options.endMonth) {
					self._createMonth();
				} else {
					self._createDay();
				}
			}, false);
			ui.m.addEventListener('change', function(e) {
				self._createDay();
			}, false);
			ui.d.addEventListener('change', function(e) {
				if (self.options.beginMonth || self.options.endMonth) { //仅提供了beginDate时，触发day,hours,minutes的change
					self._createHours();
				}
			}, false);
			ui.h.addEventListener('change', function(e) {
				if (self.options.beginMonth || self.options.endMonth) {
					self._createMinutes();
				}
			}, false);
			ui.mask[0].addEventListener('tap', function() {
				self.hide();
			}, false);
			self._create(options);
			//防止滚动穿透
			self.ui.picker.addEventListener($.EVENT_START, function(event) {
				event.preventDefault();
			}, false);
			self.ui.picker.addEventListener($.EVENT_MOVE, function(event) {
				event.preventDefault();
			}, false);
		},
		getSelected: function() {
			var self = this;
			var ui = self.ui;
			var type = self.options.type;
			var selected = {
				type: type,
				y: ui.y.picker.getSelectedItem(),
				m: ui.m.picker.getSelectedItem(),
				d: ui.d.picker.getSelectedItem(),
				h: ui.h.picker.getSelectedItem(),
				i: ui.i.picker.getSelectedItem(),
				toString: function() {
					return this.value;
				}
			};
			switch (type) {
			    case 'dateSecond':
			        selected.value = selected.y.value + '-' + selected.m.value + '-' + selected.d.value + ' ' + selected.h.value + ':' + selected.i.value + ':' + new Date().getSeconds();
                    selected.text = selected.y.text + '-' + selected.m.text + '-' + selected.d.text + ' ' + selected.h.text + ':' + selected.i.text + ':' + new Date().getSeconds();
    				break;
				case 'datetime':
					selected.value = selected.y.value + '-' + selected.m.value + '-' + selected.d.value + ' ' + selected.h.value + ':' + selected.i.value;
					selected.text = selected.y.text + '-' + selected.m.text + '-' + selected.d.text + ' ' + selected.h.text + ':' + selected.i.text;
					break;
				case 'date':
					selected.value = selected.y.value + '-' + selected.m.value + '-' + selected.d.value;
					selected.text = selected.y.text + '-' + selected.m.text + '-' + selected.d.text;
					break;
				case 'time':
					selected.value = selected.h.value + ':' + selected.i.value;
					selected.text = selected.h.text + ':' + selected.i.text;
					break;
				case 'month':
					selected.value = selected.y.value + '-' + selected.m.value;
					selected.text = selected.y.text + '-' + selected.m.text;
					break;
				case 'hour':
					selected.value = selected.y.value + '-' + selected.m.value + '-' + selected.d.value + ' ' + selected.h.value;
					selected.text = selected.y.text + '-' + selected.m.text + '-' + selected.d.text + ' ' + selected.h.text;
					break;
                case 'yearOnly':
                    selected.value = selected.y.value;
                    selected.text = selected.y.text;
                    break;
                case 'monthOnly':
                    selected.value = selected.m.value;
                    selected.text = selected.m.text;
                    break;
                case 'timeSecond':
                    selected.value = selected.h.value + ':' + selected.i.value + ':' + new Date().getSeconds();
                    selected.text = selected.h.text + ':' + selected.i.text + ':' + new Date().getSeconds();
                    break;
			}
			return selected;
		},
		setSelectedValue: function(value) {
			var self = this;
			var ui = self.ui;
			var parsedValue = self._parseValue(value);
			//TODO 嵌套过多，因为picker的change时间是异步(考虑到性能)的，所以为了保证change之后再setSelected，目前使用回调处理
			ui.y.picker.setSelectedValue(parsedValue.y, 0, function() {
				ui.m.picker.setSelectedValue(parsedValue.m, 0, function() {
					ui.d.picker.setSelectedValue(parsedValue.d, 0, function() {
						ui.h.picker.setSelectedValue(parsedValue.h, 0, function() {
							ui.i.picker.setSelectedValue(parsedValue.i, 0);
						});
					});
				});
			});
		},
		isLeapYear: function(year) {
			return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
		},
		_inArray: function(array, item) {
			for (var index in array) {
				var _item = array[index];
				if (_item === item) return true;
			}
			return false;
		},
		getDayNum: function(year, month) {
			var self = this;
			if (self._inArray([1, 3, 5, 7, 8, 10, 12], month)) {
				return 31;
			} else if (self._inArray([4, 6, 9, 11], month)) {
				return 30;
			} else if (self.isLeapYear(year)) {
				return 29;
			} else {
				return 28;
			}
		},
		_fill: function(num) {
			num = num.toString();
			if (num.length < 2) {
				num = 0 + num;
			}
			return num;
		},
		_isBeginYear: function() {
			return this.options.beginYear === parseInt(this.ui.y.picker.getSelectedValue());
		},
		_isBeginMonth: function() {
			return this.options.beginMonth && this._isBeginYear() && this.options.beginMonth === parseInt(this.ui.m.picker.getSelectedValue());
		},
		_isBeginDay: function() {
			return this._isBeginMonth() && this.options.beginDay === parseInt(this.ui.d.picker.getSelectedValue());
		},
		_isBeginHours: function() {
			return this._isBeginDay() && this.options.beginHours === parseInt(this.ui.h.picker.getSelectedValue());
		},
		_isEndYear: function() {
			return this.options.endYear === parseInt(this.ui.y.picker.getSelectedValue());
		},
		_isEndMonth: function() {
			return this.options.endMonth && this._isEndYear() && this.options.endMonth === parseInt(this.ui.m.picker.getSelectedValue());
		},
		_isEndDay: function() {
			return this._isEndMonth() && this.options.endDay === parseInt(this.ui.d.picker.getSelectedValue());
		},
		_isEndHours: function() {
			return this._isEndDay() && this.options.endHours === parseInt(this.ui.h.picker.getSelectedValue());
		},
		_createYear: function(current) {
			var self = this;
			var options = self.options;
			var ui = self.ui;
			//生成年列表
			var yArray = [];
			if (options.customData.y) {
				yArray = options.customData.y;
			} else {
				var yBegin = options.beginYear;
				var yEnd = options.endYear;
				for (var y = yBegin; y <= yEnd; y++) {
					yArray.push({
						text: y + '',
						value: y
					});
				}
			}
			ui.y.picker.setItems(yArray);
			//ui.y.picker.setSelectedValue(current);
		},
		_createMonth: function(current) {
			var self = this;
			var options = self.options;
			var ui = self.ui;

			//生成月列表
			var mArray = [];
			if (options.customData.m) {
				mArray = options.customData.m;
			} else {
				var m = options.beginMonth && self._isBeginYear() ? options.beginMonth : 1;
				var maxMonth = options.endMonth && self._isEndYear() ? options.endMonth : 12;
				for (; m <= maxMonth; m++) {
					var val = self._fill(m);
					mArray.push({
						text: val,
						value: val
					});
				}
			}
			ui.m.picker.setItems(mArray);
			//ui.m.picker.setSelectedValue(current);
		},
		_createDay: function(current) {
			var self = this;
			var options = self.options;
			var ui = self.ui;

			//生成日列表
			var dArray = [];
			if (options.customData.d) {
				dArray = options.customData.d;
			} else {
				var d = self._isBeginMonth() ? options.beginDay : 1;
				var maxDay = self._isEndMonth() ? options.endDay : self.getDayNum(parseInt(this.ui.y.picker.getSelectedValue()), parseInt(this.ui.m.picker.getSelectedValue()));
				for (; d <= maxDay; d++) {
					var val = self._fill(d);
					dArray.push({
						text: val,
						value: val
					});
				}
			}
			ui.d.picker.setItems(dArray);
			current = current || ui.d.picker.getSelectedValue();
			//ui.d.picker.setSelectedValue(current);
		},
		_createHours: function(current) {
			var self = this;
			var options = self.options;
			var ui = self.ui;
			//生成时列表
			var hArray = [];
			if (options.customData.h) {
				hArray = options.customData.h;
			} else {
				var h = self._isBeginDay() ? options.beginHours : 0;
				var maxHours = self._isEndDay() ? options.endHours : 23;
				for (; h <= maxHours; h++) {
					var val = self._fill(h);
					hArray.push({
						text: val,
						value: val
					});
				}
			}
			ui.h.picker.setItems(hArray);
			//ui.h.picker.setSelectedValue(current);
		},
		_createMinutes: function(current) {
			var self = this;
			var options = self.options;
			var ui = self.ui;

			//生成分列表
			var iArray = [];
			if (options.customData.i) {
				iArray = options.customData.i;
			} else {
				var i = self._isBeginHours() ? options.beginMinutes : 0;
				var maxMinutes = self._isEndHours() ? options.endMinutes : 59;
				for (; i <= maxMinutes; i++) {
					var val = self._fill(i);
					iArray.push({
						text: val,
						value: val
					});
				}
			}
			ui.i.picker.setItems(iArray);
			//ui.i.picker.setSelectedValue(current);
		},
		_setLabels: function() {
			var self = this;
			var options = self.options;
			var ui = self.ui;
			ui.labels.each(function(i, label) {
				label.innerText = options.labels[i];
			});
		},
		_setButtons: function() {
			var self = this;
			var options = self.options;
			var ui = self.ui;
			ui.cancel.innerText = options.buttons[0];
			ui.ok.innerText = options.buttons[1];
		},
		_parseValue: function(value) {
			var self = this;
			var rs = {};
			if (value) {
				var parts = value.replace(":", "-").replace(" ", "-").split("-");
				rs.y = parts[0];
				rs.m = parts[1];
				rs.d = parts[2];
				rs.h = parts[3];
				rs.i = parts[4];
			} else {
				var now = new Date();
				rs.y = now.getFullYear();
				rs.m = now.getMonth() + 1;
				rs.d = now.getDate();
				rs.h = now.getHours();
				rs.i = now.getMinutes();
			}
			return rs;
		},
		_create: function(options) {
			var self = this;
			options = options || {};
			options.labels = options.labels || ['年', '月', '日', '时', '分'];
			options.buttons = options.buttons || ['取消', '确定'];
			options.type = options.type || 'datetime';
			options.customData = options.customData || {};
			self.options = options;
			var now = new Date();
			var beginDate = options.beginDate;
			if (beginDate instanceof Date && !isNaN(beginDate.valueOf())) { //设定了开始日期
				options.beginYear = beginDate.getFullYear();
				//change linjing 去除月份加1
				// options.beginMonth = beginDate.getMonth() + 1;
				options.beginMonth = beginDate.getMonth()
				options.beginDay = beginDate.getDate();
				options.beginHours = beginDate.getHours();
				options.beginMinutes = beginDate.getMinutes();
			}
			var endDate = options.endDate;
			if (endDate instanceof Date && !isNaN(endDate.valueOf())) { //设定了结束日期
				options.endYear = endDate.getFullYear();
				//change linjing 去除月份加1
				// options.endMonth = endDate.getMonth() + 1;
				options.endMonth = endDate.getMonth();
				options.endDay = endDate.getDate();
				options.endHours = endDate.getHours();
				options.endMinutes = endDate.getMinutes();
			}
			options.beginYear = options.beginYear || (now.getFullYear() - 5);
			options.endYear = options.endYear || (now.getFullYear() + 5);
			var ui = self.ui;
			//设定label
			self._setLabels();
			self._setButtons();
			//设定类型
			ui.picker.setAttribute('data-type', options.type);
			//生成
			self._createYear();
			self._createMonth();
			self._createDay();
			self._createHours();
			self._createMinutes();
			//设定默认值
			self.setSelectedValue(options.value);
		},
		//显示
		show: function(callback) {
			var self = this;
			var ui = self.ui;
			self.callback = callback || $.noop;
			ui.mask.show();
			document.body.classList.add($.className('dtpicker-active-for-page'));
			ui.picker.classList.add($.className('active'));
			//处理物理返回键
			self.__back = $.back;
			$.back = function() {
				self.hide();
			};
		},
		hide: function() {
			var self = this;
			if (self.disposed) return;
			var ui = self.ui;
			ui.picker.classList.remove($.className('active'));
			ui.mask.close();
			document.body.classList.remove($.className('dtpicker-active-for-page'));
			//处理物理返回键
			$.back = self.__back;
		},
		dispose: function() {
			var self = this;
			self.hide();
			setTimeout(function() {
			    if(self.ui){
    				self.ui.picker.parentNode.removeChild(self.ui.picker);
    				for (var name in self) {
    					self[name] = null;
    					delete self[name];
    				};
    				self.disposed = true;
				}
			}, 300);
		}
	});

})(mui, document);(function(parentObj, parentNames) {
    var dateTime = parentObj.create(parentNames);
    
    var suppTime = jq('.supp-date-time');
    suppTime.each(function(index,timeObj) {
        timeObj.addEventListener('click', function() {
            var that = jq(this);
            var linkId = this.getAttribute('data-link-id');
            var resultTime = jq("#" + linkId);
            
            //设置日期类型
            var options = {};
            if (that.is(".form_date_time")) {  //年月日时分秒
                options["type"] = "dateSecond";
            } else if (that.is(".form_date_minute")) {  //年月日时分
                options["type"] = "datetime";
            } else if (that.is(".form-date-hour")) {  //年月日时
                options["type"] = "hour";
            } else if (that.is(".form-date")) {  //年月日
                options["type"] = "date";
            } else if (that.is(".form-year-month")) {  //年月
                options["type"] = "month";
            } else if (that.is(".form_minute")) {  //时分
                options["type"] = "time";
            } else if (that.is(".form_time")) {  //时分秒
                options["type"] = "timeSecond";
            } else if (that.is(".form_year")) {  //年
                options["type"] = "yearOnly";
            } else if (that.is(".form_month")) {  //月
                options["type"] = "monthOnly";
            }
            // var optionsJson = this.getAttribute('data-options') || '{}';
            // var options = JSON.parse(optionsJson);
             
            // 设置起始时间
            if (that.attr("data-start-time") != undefined) {
                var dataStartTime = that.attr("data-start-time").split("-");
                if (dataStartTime.length == 3) {
                    options["beginDate"] = new Date(dataStartTime[0],dataStartTime[1],dataStartTime[2]);
                } else if (dataStartTime.length == 2) {
                    options["beginDate"] = new Date(dataStartTime[0],dataStartTime[1]);
                } else {
                    options["beginYear"] = dataStartTime[0];
                }
            }
            
            // 设置起始时间
            if (that.attr("data-end-time") != undefined) {
                var dataEndTime = that.attr("data-end-time").split("-");
                if (dataStartTime.length == 3) {
                    options["endDate"] = new Date(dataEndTime[0],dataEndTime[1],dataEndTime[2]);
                } else if (dataStartTime.length == 2) {
                    options["endDate"] = new Date(dataEndTime[0],dataEndTime[1])
                } else {
                    options["endYear"] = dataEndTime[0];
                }
            }
            
            /*
             * 首次显示时实例化组件
             * 示例为了简洁，将 options 放在了按钮的 dom 上
             * 也可以直接通过代码声明 optinos 用于实例化 DtPicker
             */
            var picker = new mui.DtPicker(options);
            picker.show(function(rs) {
                /*
                 * rs.value 拼合后的 value
                 * rs.text 拼合后的 text
                 * rs.y 年，可以通过 rs.y.vaue 和 rs.y.text 获取值和文本
                 * rs.m 月，用法同年
                 * rs.d 日，用法同年
                 * rs.h 时，用法同年
                 * rs.i 分（minutes 的第二个字母），用法同年
                 */
                if (resultTime.is("input") || resultTime.is("textarea")) {
                    resultTime.val(rs.text);
                } else{
                    resultTime.html(rs.text);
                }
                /* 
                 * 返回 false 可以阻止选择框的关闭
                 * return false;
                 */
                /*
                 * 释放组件资源，释放后将将不能再操作组件
                 * 通常情况下，不需要示放组件，new DtPicker(options) 后，可以一直使用。
                 * 当前示例，因为内容较多，如不进行资原释放，在某些设备上会较慢。
                 * 所以每次用完便立即调用 dispose 进行释放，下次用时再创建新实例。
                 */
                picker.dispose();
            });
        }, false);
    });
})(Supp.Base,"Supp.Date");(function(parentObj, parentNames) {
    var indexedList = parentObj.create(parentNames);
    indexedList.init = function(setting){
        if (setting != undefined && setting.renderTo != undefined && setting.renderTo != "") {
            jq("#" + setting.renderTo).parents(".sideslip").show();
        }
        
        var params = {
             renderTo:"",
             url:'',
             chkStyle:"checkbox"
        };
        jq.extend(params,setting);
        
        var $me = jq("#"+params.renderTo),
        $bar = jq('.supp-indexed-list-bar'),
        $barItems = jq('.supp-indexed-list-bar a'),
        $alert = jq(('.supp-indexed-list-alert')),
        $inner = jq(".supp-indexed-list-inner");

        //加载数据
        var loadData = function(url){
            var str = "<form>";
            var chkStyle = params.chkStyle;
            Supp.ajax({
                url : url,
                cache : false,
                dataType : "json",
                type: 'post',
                success : function(resp){
                    if (resp != undefined){
                        for(var key in resp){
                            str += '<li data-group="'+ key +'" class="supp-table-view-divider supp-indexed-list-group">'+ key +'</li>';
                            for(var i=0;i<resp[key].length;i++){
                                str += '<li data-value="'+ resp[key][i].id +'" class="supp-table-view-cell supp-indexed-list-item mui-'+ chkStyle +'">'
                                     + '<input type="'+ chkStyle +'" id="'+ chkStyle + '_' + resp[key][i].id +'" name="indexed_'+chkStyle+'" value="'+ resp[key][i].id +'"/>'
                                     + '<label for="'+ chkStyle + '_' + resp[key][i].id +'">'
                                     + '<span>'+ resp[key][i].text +'</span>'
                                     + '</label>'
                                     + '</li>';
                            }
                        }
                    }
                    str += '</form>';
                    $me.find(".supp-table-view").html(str);
                },
                error : function(error){
                   console.log(error);
                }              
            });
        }
        
        //计算布局
        var caleLayout = function() {      
            var height = $me.parent().height();
            var barItemHeight = (height) / $barItems.length;
            $barItems.each(function(i,n) {
                jq(n).css(
                    {
                        "height":barItemHeight + "px",
                        "line-height":barItemHeight + "px"
                    }
                );
            });
        }
        
        //滚动
        var scrollTo = function(group) {
            var groupElement = jq('li[data-group="'+ group +'"]')[0];
            if (!groupElement) {
                return;
            }
            $inner.scrollTop(groupElement.offsetTop);
        }
        
        //绑定事件
        var bindEvent = function() {
            var pointElement = null;

            var findStart = function(event) {
                if (pointElement) {
                    jq(pointElement).removeClass('active');
                    pointElement = null;
                }
               
                $bar.addClass("active");
                var point = event.changedTouches ? event.changedTouches[0] : event;
                pointElement = document.elementFromPoint(point.pageX, point.pageY);
               
                if (pointElement) {
                    var group = pointElement.innerText;
                    if (group && group.length == 1) {
                        jq(pointElement).addClass('active');
                        $alert.html(group);
                        $alert.addClass("active");
                        scrollTo(group);
                    }
                }
                event.preventDefault();
            };
            
            var findEnd = function(event) {
                $alert.removeClass('active');
                $bar.removeClass('active');
                if (pointElement) {
                    jq(pointElement).removeClass('active');
                    pointElement = null;
                }
            };

            $bar[0].addEventListener(jq.EVENT_MOVE, function(event) {
                findStart(event);
            }, false);
            $bar[0].addEventListener(jq.EVENT_START, function(event) {
                findStart(event);
            }, false);
            document.body.addEventListener(jq.EVENT_END, function(event) {
                findEnd(event);
            }, false);
            document.body.addEventListener(jq.EVENT_CANCEL, function(event) {
                findEnd(event);
            }, false);        
        }
       
        loadData(params.url);
        caleLayout();
        bindEvent();

    }

    indexedList.resetList = function(listId){
        var $form = jq("#"+listId).find("form");
        $form[0].reset();
    }

    indexedList.getList = function(listId){
        var $form = jq("#"+listId).find("form"),chk_value=[];
        $form.find("input:checked").each(function(){
            chk_value.push(jq(this).val()); 
        });
        return chk_value;
    }
})(Supp.Base,"Supp.IndexedList");
/*
 * 页面元素公共方法调用
 */
jq(function() {
    Supp.Page.toggleFooterStyle();
    Supp.Page.tabPageToggle();
    Supp.Page.toggleTitleListShow();
    Supp.Page.showAllDescribMes();
    Supp.Page.selectRadioList();
    Supp.Page.showPullDownLayer();
    Supp.Page.fillPullDownConente();
});

(function(parentObj, parentNames){
    var pageObj = parentObj.create(parentNames);
    /*
     * 页面底部选择样式切换
     */
    pageObj.toggleFooterStyle = function(){
        jq(".supp-page-footer li").on("click",function(){
            jq(this).addClass("active").siblings("li").removeClass("active");
        })
    };
    
    /*
     * tab页签切换功能
     */
    pageObj.tabPageToggle = function(){
        jq(".supp-tab-page li").each(function(index,element){
            var element = jq(element);
            if (element.is(".skin-item-active")) {
                var targetId = element.attr("data-target-id");
                jq("#" + targetId).show();
            }
        });
        jq(".supp-tab-page li").on("click",function(){
            var that = jq(this);
            var targetId = that.attr("data-target-id");
            that.addClass("skin-item-active").siblings("li").removeClass("skin-item-active");
            jq("#" + targetId).show().siblings(".supp-tab-content").hide();
        })
    };
    
    /*
     * 切换表单列表显示隐藏
     */
    pageObj.toggleTitleListShow = function(){
        jq(".supp-list-title").each(function(index,curList){
            var curList = jq(curList);
            if (curList.attr("data-open") == "true") {
                var targetId = curList.attr("data-target-id").split(",");
                for (var i in targetId) {
                    jq("#" +　targetId[i]).show();
                    curList.children(".supp-arrow-right-lg").addClass("supp-arrow-bottom-lg");
                }
            }
        });
        jq(".supp-list-title").on("click",function(){
            var targetIds = jq(this).attr("data-target-id").split(",");
            for (var i in targetIds) {
                var targetListCon = jq("#" + targetIds[i]);
                if (targetListCon.css("display") == "none") {
                    targetListCon.show();
                    jq(this).children(".supp-arrow-right-lg").addClass("supp-arrow-bottom-lg");
                } else {
                    targetListCon.hide();
                    jq(this).children(".supp-arrow-right-lg").removeClass("supp-arrow-bottom-lg");
                }
            }
            
            
        });
    };
    
    /*
     * 点击更多显示全部应用描述
     */
    pageObj.showAllDescribMes = function(){
        jq(".supp-describ-mes").on("click",function(){
            var suppMoreMes = jq(this).children(".supp-more-mes");
            if (suppMoreMes.css("display") == "block") {
                jq(this).removeClass("ellipsis-2");
                suppMoreMes.hide();
            } else {
                jq(this).addClass("ellipsis-2");
                suppMoreMes.show();
            }
        })
    };
    
    /*
     * 单选列表选中对号添加
     */
    pageObj.selectRadioList = function(){
        jq(".supp-radio-list").delegate("li","click",function(){
            jq(this).addClass("icon-fa-check").siblings("li").removeClass("icon-fa-check");
        })
    };
    
    /*
     *获取下拉列表浮动层背景高度
     */
    pageObj.getPullLayerHeight = function(){
        //获取可见区域高度
        var clientHeight = document.body.clientHeight;
        //获取上部分高度
        var topHeight = jq(".supp-page-header").height() + jq(".supp-page-header").next().height();
        
        var layerHeight = clientHeight - topHeight - jq(".supp-pull-title").height();
        jq(".supp-pull-content").height(layerHeight);
    }
    
    /*
     * 显示下拉列表浮动层
     */
    pageObj.showPullDownLayer = function(){
        jq(".supp-pull-title").delegate("li","click",function(){
            var element = jq(this);
            var targetId = element.attr("data-target-id");
            jq("#" + targetId).parent().show();
            Supp.Page.getPullLayerHeight();
            element.addClass("active").siblings("li").removeClass("active");
            jq("#" + targetId).show().siblings("ul").hide();
        })
    };
    
    /*
     * 选中填充下拉值
     */
    pageObj.fillPullDownConente = function(){
        jq(".supp-pull-content").delegate("li","click",function(){
            var element = jq(this);
            var text = element.text();
            jq(".supp-pull-title").children("li.active").children("span").html(text);
            jq(".supp-pull-title").children("li.active").removeClass("active");
            element.parent().hide();
            element.parent().parent().hide();
        });
        jq(".supp-pull-content").on("click",function(){
            jq(".supp-pull-title").children("li.active").removeClass("active");
            jq(".supp-pull-content").hide();
        })
    }
})(Supp.Base,"Supp.Page")






















/**
 * Supp移动UI工具.
 */
;(function(parentObj, parentNames) {
    var sideslip = parentObj.create(parentNames);
    /**
     *初始化sideslip.
     * initParams:{
     *     type:侧滑类型(滑动方向):left、right、top、bottom，默认为right
     * }，如果参数不为json格式，则默认为type类型
     * height:侧滑窗体的高度，默认为总窗体高度减去header的高度
     */
    sideslip.init = function (initParams) {
        var type = "right";
        
        if (initParams != undefined && initParams != "") {
            if (Supp.Util.isJson(initParams)) {
                type = initParams.type;
            } else {
                type = initParams;
            }
        }
        
        jq(function() {
            var $sideslips = jq(".sideslip");
            if ($sideslips != undefined && $sideslips.length > 0) {
                for (var i = 0;i < $sideslips.length;i++) {
                    var $sideslip = jq($sideslips[i]);
                    
                    if (type == "right") {
                        var bodyWidth = document.body.clientWidth;
                        $sideslip.css("left",bodyWidth);
                        $sideslip.attr("data-pos",type);
                    } else if (type == "left"){
                        var sideslipWidth = $sideslip.css("width");
                        if (sideslipWidth != undefined) {
                            sideslipWidth = sideslipWidth.replace("px","");
                        }
                        $sideslip.css("left",-sideslipWidth);
                        $sideslip.attr("data-pos",type);
                    }
                    
                    //计算侧滑窗体高度
                    // $pageHeader = jq(".supp-page-header");
                    // if ($pageHeader != undefined && $pageHeader.length > 0) {
                        // var bodyHeight = document.body.clientHeight;
                        // var pageHeaderHeight = $pageHeader.height();
                        // $sideslip.css("height",bodyHeight - pageHeaderHeight);
                    // }
                }
            }
        });
    }
    
    /**
     *将sideslip显示出来.
     * sideslipId：要显示的侧滑页面的id.
     * callback：侧滑效果完成后的回调函数.
     */
    sideslip.sideSlipShow = function (sideslipId,callback) {
      //将sideslip显示出来
      var $sideslip = jq("#" + sideslipId);
      $sideslip.show();
      var bodyWidth = document.body.clientWidth;
      var sideslipWidth = $sideslip.css("width");
      if (sideslipWidth != undefined) {
          sideslipWidth = sideslipWidth.replace("px","");
      }
      
      var left = 0;
      var type = $sideslip.attr("data-pos");
      
      if (type == "right") {
          left = bodyWidth - sideslipWidth;
      } else if (type == "left"){
          left = 0;
      }
      
      $sideslip.animate({
          left:left,
          duration: 300,
          easing: 'linear'
      },function(){
          if (typeof callback == "function"){
              callback();
          }
      });
      
      //记录此sideslip状态为显示
      $sideslip.attr("data-show",true);
      
      //如果遮罩层不存在，则创建遮罩
      var sideslipLayerDiv = jq(".sideslip-layer");
      if (sideslipLayerDiv == undefined || sideslipLayerDiv.length == 0) {
          sideslipLayerDiv = jq("<div>").addClass("sideslip-layer");
          jq(document.body).append(sideslipLayerDiv);
      }
      
      /**
        * 如果点击遮罩层，则将所有的侧滑页面删除 
        */
       jq(".sideslip-layer").click(function(event){
           var left = 0;
           if (type == "right"){
               left = bodyWidth;
           } else if (type == "left"){
               left = -sideslipWidth;
           }
           
           jq(".sideslip").animate({
               left:left,
               duration: 300,
               easing: 'linear'
           },function(){
               jq(".sideslip").hide();
           });
           jq(".sideslip-layer").remove();
       });
    }
    
     /**
     *将sideslip隐藏起来.
     * sideslipId：要隐藏的侧滑页面的id.
     * callback：侧滑效果完成后的回调函数.
     */
    sideslip.sideSlipHide = function (sideslipId,callback) {
        //将sideslip隐藏起来
        var $sideslip = jq("#" + sideslipId);
        $sideslip.hide();
        //侧滑类型
        var type = $sideslip.attr("data-pos");
        
        var left = 0;
        
        if (type == "right") {
            left = document.body.clientWidth;
        } else if (type == "left"){
            var sideslipWidth = $sideslip.css("width");
            if (sideslipWidth != undefined) {
                sideslipWidth = sideslipWidth.replace("px","");
                left = -sideslipWidth;
            }
        }
        
        $sideslip.animate({
            left:left,
            duration: 300,
            easing: 'linear'
        },function(){
            if (typeof callback == "function"){
                callback();
            }
        });
        
        //记录此sideslip状态为隐藏
        $sideslip.attr("data-show",false);
        
        var allSideslipsHide = true;
        var $sideslips = jq(".sideslip");
        if ($sideslips != undefined && $sideslips.length > 0) {
            for (var i = 0;i < $sideslips.length;i++) {
                if (jq($sideslips[i]).attr("data-show") == "true") {
                    allSideslipsHide = false;
                    break;
                }
            }
        }
        
        //如果所有的sideslip状态均为隐藏则将遮罩移除
        if (allSideslipsHide == true) {
            jq(".sideslip-layer").remove();
        }
    }
})(Supp.Base, "Supp.SideSlip");